SSHD Password Feedback (Show Asterisks for Characters)
You can override what tool is used to ask for the passwords/passphrases via the environment variable $SSH_ASKPASS
.
$ echo $SSH_ASKPASS
/usr/libexec/openssh/gnome-ssh-askpass
excerpt - Password Reading and Handling
Password Reading Programs.
Why re-invent the wheel. There are lots of programs that have already been written for getting password from users, and which then pipe the result to stdout, ready to feed into the program that needs it, or to be buffered in a variable.
Examples include...
/usr/libexec/openssh/x11-ssh-askpass /usr/libexec/openssh/ssh-askpass /usr/bin/ssh-askpass /usr/libexec/openssh/gnome-ssh-askpass /usr/lib/openssh/gnome-ssh-askpass zenity --title=Program --entry --text=Password: --hide-text Xdialog --title Program --stdout --password --inputbox "Password:" 0x0 { echo "SETDESC password:"; echo "GETPIN"; } | pinentry | sed -n 's/^D //p'
And probably many many others that essentially does exactly what the above script is trying to do. I have often written encrypting and mounting scripts that search to find at least one of these programs to use for user password input.
References
- Entering password in Terminal gives no visual feedback
- Lack of visual feedback on password entry