Você pode substituir a ferramenta usada para solicitar as senhas / senhas por meio da variável de ambiente $SSH_ASKPASS
.
$ echo $SSH_ASKPASS
/usr/libexec/openssh/gnome-ssh-askpass
excerto - Leitura e tratamento de senhas
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.