The context :
- Debian Stretch workstation trying to SSH to numerous GNU/Linux servers (mostly RH and Debian)
- I can not change the SSH configuration of the remote servers
- I know this is far from ideal, but I have to login with login + password. No SSH key, plain old login/pass. I can NOT change this (no need to suggest using keys + passphrases)
- sshpass -V : "sshpass 1.06"
This answer gives an interesting hint using 'ssphass'.
What I've set up in '~/.ssh/config' :
Host myServer
HostName 12.34.56.78
User bob
ProxyCommand sshpass -v -pmyPassword ssh %r@%h -W localhost:%p
NB: the '-v' sshpass option is there only to get details while asking this question
When I try to connect via SSH :
me@myWorkstation$ ssh myServer
SSHPASS searching for password prompt using match "assword"
SSHPASS read: bob@12.34.56.78's password:
SSHPASS detected prompt. Sending password.
SSHPASS read:
bob@12.34.56.78's password:
And it waits like this forever š
If I edit '~/.ssh/config' and replace 'myPassword' (which is the real password attached to this SSH login, works when logging manually) :
Host myServer
HostName 12.34.56.78
User bob
ProxyCommand sshpass -v -pnotMyPasswordAnymoreOhNo ssh %r@%h -W localhost:%p
which gives :
me@myWorkstation$ ssh myServer
SSHPASS searching for password prompt using match "assword"
SSHPASS read: bob@12.34.56.78's password:
SSHPASS detected prompt. Sending password.
SSHPASS read:
Permission denied, please try again.
SSHPASS read: bob@12.34.56.78's password:
SSHPASS detected prompt, again. Wrong password. Terminating.
ssh_exchange_identification: Connection closed by remote host
I actually get a reply (albeit negative).
Could you explain why ?
Best Answer
man sshpass say:
You can try save ENV variable and store pass there, but it's to bad practice.