I need to frequently login to many machines but I can only login to them from a proxy machine or using an SSH tunnel (by tunneling through that proxy machine). The problem is that I cannot use authorized_keys on the proxy machine, therefore I need to enter the password every time I setup the tunnel.

How can I automate it? I was thinking about combining expect with some way to enter the password automatically without having to store it openly.

I am using Linux on all of the machines mentioned.


How about using agent forwarding?

You can enable it in /etc/ssh/ssh_config (or ~/.ssh/config):

Host *
ForwardAgent yes

or add "-A" every time you connect to your proxy: ssh -A user@remote_host

By enabling this, you allow your proxy to forward your key to your target machines, so you can freely connect to other machines.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.