20

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.

2 Answers 2

19

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

1
  • Works a treat ;)
    – Gman
    May 22, 2019 at 9:49
10

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.

5
  • 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, 2017 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. Nov 26, 2017 at 20:44
  • This creates a local proxy, it does not allow one to SSH tunnel through an intermediary host. Jul 12, 2018 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, 2018 at 8:50
  • This works! @skoval00, if you use RSA/PrivateKey to authenticate you shouldn't face a problem.
    – Sam Sirry
    Mar 2, 2023 at 10:03

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .