I had a problem of having the ports on my lab machine blocked to external connections by a firewall. In other words, I couldn't connect to my lab machine's ssh server from home. But I had ssh access to the firewall. So I created a ssh tunnel to my lab machine as follows:
$ ssh -fN -L 9500:my.lab.machine:22 myfirewalllogin@the.firewall.machine
This will create a ssh tunnel in the background through the firewall machine and maps my lab machine's ssh port (22) to my localhost's port 9500 (can be any higher ports).
Now I can create the ssh connection to my lab machine as if it is in my local host:
$ ssh -p 9500 mylablogin@localhost
If you want to do scp files you can do similar but with -P (capital P) instead -p.
$ scp -P 9500 mylablogin@localhost:labfiles localdir
Anybody can figure it out my carefully reading the ssh man page ;-) and this approach works for accessing any remote, behind-the-firewall applications (mail server, rsync, etc.)
Sunday, February 24, 2008
Subscribe to:
Posts (Atom)