[Gllug] SSH stupidity (from me)

Richard W.M. Jones rich at annexia.org
Mon Mar 17 10:51:16 UTC 2003


On Sun, Mar 16, 2003 at 08:17:32PM +0000, Adrian McMenamin wrote:
>     ssh -v -C -l str -R 7890:localhost:22 remotehost "sleep 120"

This is the important line. Run it on your homechoice machine (behind
the NAT), and have it connecting to your remotehost machine (somewhere
on the internet).

So it makes a connection to the remote machine and just runs the
sleep command. The important feature is the -R ... option. This
causes the remote machine to listen on port 7890 for any TCP
connection, and route that connection magically back to the local
machine (behind the NAT) to port 22.

ie. If you are logged into remotehost, and you type:

  telnet localhost 7890

you'll see the ssh signature of the machine behind the NAT firewall
appear. So to actually make a connection back, use:

  ssh -p 7890 localhost

Which logs you into your home machine.

Here's the actual proper command (replace "remotehost" with the
name for your remote machine).

while true; do
  ssh -R 7890:localhost:22 remotehost "sleep 100000"
  sleep 10
done

Rich.

-- 
Richard Jones, Red Hat Inc. (London, UK) http://www.redhat.com/software/ccm
http://www.annexia.org/ Freshmeat projects: http://freshmeat.net/users/rwmj
MONOLITH is an advanced framework for writing web applications in C, easier
than using Perl & Java, much faster and smaller, reusable widget-based arch,
database-backed, discussion, chat, calendaring:
http://www.annexia.org/freeware/monolith/

-- 
Gllug mailing list  -  Gllug at linux.co.uk
http://list.ftech.net/mailman/listinfo/gllug




More information about the GLLUG mailing list