2

I have some disabilities, one of which is trembling fingers. I have seen methods of turning on asterisks via pwdfeedback, but that's insufficient for me, as I sometimes press on the ridge between keys, and I don't know which one I actually typed.

The computer on which I have a Linux distro installed is almost always airgapped, and does not ever contain security-relevant data. I literally only use it for writing and uploading firmware to Arduino boards in my home workshop. (It only ever gets a network connection when I am updating libraries, it doesn't even have a wifi card, I use USB tethering). Can anyone help?

AdminBee
  • 22,803
  • 3
    Probably the simplest way would be to type in another terminal or text editor and copy paste. Or save it in a password manager and copy from there. Simpler than configuring different tools to show the password, anyway. – muru Feb 06 '23 at 00:50
  • I think you are using sudo, aren't you? Because you can pass the password from stdin by using sudo -S command – Edgar Magallon Feb 06 '23 at 00:55
  • Are you also talking about password prompts like on your graphical desktop's login screen? – Kusalananda Apr 12 '23 at 18:36

1 Answers1

0

See What's the purpose of using `sudo -S` explicitly?

I created a script with the following:

#!/bin/bash

for arg in "$@"; do if [ "$arg" == "$1" ]; then printf "password\n" | sudo -S $arg else sudo $arg fi done

Then ran

sudo chmod 555 scriptname
sudo cp scriptname /usr/local/bin

From there you can run the script in any directory by simply typing the name of it and passing arguments/commands to it

scriptname "command 1" "command 2" "command 3"

Surround your command with quotes so it's one argument but you may need to be careful if the command has quotes as well due to shell expansion. Replacing the quotes in the command with single quotes has worked for me so far but I'm not sure in all situations and it may depend on what shell you're using. Alternatively, have your script contain

#!/bin/bash

printf "password\n"

And then invoke the script like so

scriptname | sudo -S [command]
  • This answer seems to concentrate on sudo even though the user in the question never actually mentioned this tool, or any other specific utility or type of password prompt. – Kusalananda Apr 12 '23 at 19:00
  • Agreed. I'm interested in other answers as I just started looking into this myself a little bit – Growing My Roots Apr 12 '23 at 20:09