Putty SSH Multi-hop X11 Forwarding

Wall of Fire Card

If your remote computer is sitting behind a firewall, and you need to go through a sshgateway server, you can use a simple multi-hop instead of a tunnel. e.g.
Home_Computer-> SSH_Gateway -> Work_Computer


With plink on the command line:

plink -t -X -A username@SSH_Gateway ssh -X -A username@work_computer 

Or in Putty:

Hostname: SSH_Gateway
Data -> Auto-login username: username (for ssh gateway)
SSH -> Remote Command:

 ssh -X -A username@work_computer

Auth -> Check “Allow agent forwarding” if you are using Pageant
X11 -> Check “Enable X11 forwarding” if you want it.

What the options mean:
-t enable pty allocation (used so you can do the second ssh from gateway to the work computer)
-A agent forwarding (only needed if you are using Pageant or another key agent)
-X enable X11 forwarding (only needed if you want to send X11 back to your home computer)

If you want X11 on Windows, setup Xming and Bob’s your Uncle.

This entry was posted in Tech. Bookmark the permalink.

2 Responses to Putty SSH Multi-hop X11 Forwarding

  1. Seth Gilchrist says:

    Sam,
    Thanks for this excellent, concise post. I think the second example should read:
    ssh -X -A username@work_computer
    (with a capital ‘X’)
    I directed one of our users here, and he’s now convinced we need to recompile sshd because his X forwarding isn’t working.

  2. Sam says:

    You’re correct, fixed it.

Leave a Reply

Your email address will not be published. Required fields are marked *