# [OT] sshd reversed (?)



## fluca1978 (May 31, 2012)

Hi all,
I'm looking for an idea, if of course there could be one. I've got a FreeBSD 8.2-RELEASE behind a firewall that allows ssh traffic go out but not in. Therefore from the outside world I cannot connect to the machine. I would like the machine to connect to me (i.e., to one of my external machines) a few times a day and give me control as for a normal SSH. Maybe netcat could help, but I don't know exactly how. Any idea?


----------



## UNIXgod (May 31, 2012)

You can set up a nat and port forward.


----------



## Nightweaver (May 31, 2012)

Use SSH tunnel - connect to a machine on the outside that can accept SSH connections and then use that tunnel to access machines behind a firewall.

Your command is: `ssh -f -N -R 12345:localhost:22 [email]user@someserver.com[/email] -p 22` But there are numerous tutorials for this all over the Internet.


----------



## anomie (Jun 5, 2012)

Exactly. This is the classical situation a "reverse SSH tunnel" can be used in. (Search the 'net for those terms.) 

After issuing the command (from your FreeBSD host) that Nightweaver mentioned, you can run (from someserver.com): 
`$ ssh fbsduser@localhost -p 12345`

Note that sshd(8) must be running on both hosts.


----------

