$ man ssh
...
SSH_ASKPASS
If ssh needs a passphrase, it will read the
passphrase from the current terminal if it was run
from a terminal. If ssh does not have a terminal
associated with it but DISPLAY and SSH_ASKPASS are
set, it will execute the program specified by
SSH_ASKPASS and open an X11 window to read the
passphrase. This is particularly useful when call‐
ing ssh from a .xsession or related script. (Note
that on some machines it may be necessary to redi‐
rect the input from /dev/null to make this work.)
...
Keep in mind that ssh stands for secure shell, and if you store your user, host and password in plain text files you are misleading the tool an creating a possible security gap
$ cat ~/echo_pass
echo toor
$
$ cat ssh_session
export SSH_ASKPASS='~/echo_pass'
setsid ssh root@127.0.0.1
$ chmod u+x echo_pass
$ chmod u+x ssh_session
./ssh_session
$ ./ssh_session
Welcome to Ubuntu 18.04.5 LTS (GNU/Linux 4.15.0-121-generic x86_64)
operator@server:~$
https://stackoverflow.com/questions/1340366/how-to-make-ssh-receive-the-password-from-stdin
No comments:
Post a Comment