shameless self-promoting website
»Rejourn root
Posted Wednesday, 19 December 2007 by Miklos
Tags: en hacking

okay, i learned something today :)

you have a client behind a firewall and you have a server somewhere. and you want to ssh from the server to the client. that's exactly why ssh has a magic -R option!

if you do an

$ ssh -R 19022:localhost:22 server

that will mean that you can ssh to client:22 on the server by sshing to localhost:19022 on the server. yes, and it works even if the client is behind a firewall, yay! :)


you probably want to add this to your ~/.ssh/config on the server as well:

Host client
        NoHostAuthenticationForLocalhost yes
        HostName localhost
        Port 19022

so that you can easily just type

$ ssh client

on the server