NB: this may seem to be identical with this SO question. It is related but not identical (plus its in a different StackExchange site). In that question the author asks for a way to execute a command in a distant system. In this question I am asking how to open (and maintain) a shell over two SSH connections.I have to go through an intermediate machine (let's call it $gateway) to reach my $server. So my typical workflow is:ssh $gateway (supply password manually)ssh $server (supply password manually)I am able to configure SSH public key authentication on the hop to the $gateway but not on the second hop to the $server. So the best I can do is:ssh $gateway (no password necessary)ssh $server (supply password manually)My question is: can I use sshpass or some other method to supply the password on the second hop? I don't have privileges to install sshpass or any other software on the $gateway machine.
How to use sshpass to supply a password on the second ssh hop
ssh
Use ProxyCommand:sshpass -p server_password ssh -oProxyCommand=ssh -W %h:%p $gateway $serverIt will run the sshpass from your local host.