10

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.

12

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.

putty setup

5

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.

Putty Proxy Settings

(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.

  • this is a better solution. It is such an awesome solution that, you can set one jump profile and then use it on multiple servers, just by changing name. I think the man who "invented" Putty deserves a Platinum level Medal. – rajeev Jul 21 '17 at 0:23
  • I've had no luck using the proposed alternative to jump through my Amazon bastion, but the accepted answer works exactly as expected, leaving me with a PuTTY terminal connected to the AMI Linux instance hidden behind the bastion. IMO, it doesn't get any cleaner than that, and will save me much time each day, since I'll no longer have to look up the IP address every time I want to hop. – David A. Gray Nov 26 '17 at 20:44
  • This creates a local proxy, it does not allow one to SSH tunnel through an intermediary host. – Ian Schoonover Jul 12 '18 at 17:26
  • My "Proxy session" requires one-time password and I get stuck with "Starting local proxy command: c:\apps\plink "my-proxy-session" -nc host:port" message. How should I adjust this configuration? – skoval00 Oct 18 '18 at 8:50

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.