Can I tell PuTTY to connect to one SSH server, then automatically to another?
At work we have several servers, but only one is SSH accessible outside of our local network. If I am working from home, I use PuTTY to connect to the one that is accessible, then SSH in to whatever server I want to work on.
Is there a way to automate this process? I see there are options for 'tunnels' and for a 'proxy', but neither of these seem to quite match what I'm trying to do.
Solution 1:
Yes, In the options under Connection -> SSH. There is "Remote command:" just put in 'ssh server' or whatever string you want. The only downside to this is if you 'exit' the 2nd terminal it will auto kill the first one as well.
Solution 2:
I know it's an old question, but I think it's still useful to add an alternative.
In addition to the accepted answer, which uses SSH on the remote side as a proxy, you can also use plink
(you can get it on the offical Putty site) as a local proxy.
In the options under Connection > Proxy you select 'Local' as the proxy type and as local proxy command you enter plink "«session name»" -agent -nc %host:%port
. Replace «session name» by the name of the Putty session you want to use as a proxy.
The reason I did it this way, is that I need a specific proxy for a lot of sessions. Using this solution I can easily change the settings of the proxy server in one place.
(I think you need a full path to plink
if the program folder is not in your PATH)
Please note that the approach is a little different from the accepted answer. Using my solution, you need to enter the final host name (the protected server you want to log in to) in the session settings. Using the accepted answer you'll enter the proxy server as the host name of the session.