[TriLUG] enabling SSH into private network

Magnus magnus at trilug.org
Wed Jan 2 20:24:14 EST 2008


On Jan 2, 2008, at 8:05 PM, Alan Porter wrote:
> And as a follow-up to his amazing teaser post, Magnus will
> now give an example of how this is done!
>
> <drumroll>
>
> Take it away, Magnus!

OK assume that host "foo.example.com" is your internet-facing ssh  
gateway.

Host "bar" is a host hidden behind the firewall at example.com with no  
ports open to the Internet.  But it does listen to ssh and is  
accessible by machine "foo" that sits on the same network.

On your ssh client machine, edit the file ~/.ssh/config (by default  
you likely won't even have this file... but that's ok... create it if  
you need to)

# begin addition to ~/.ssh/config
Host = bar
HostName = bar.example.com
ProxyCommand ssh foo.example.com nc %h %p 2> /dev/null
# end addition to ~/.ssh/config

"nc" (netcat) must exist on foo.example.com in the system path for  
this to work.



More information about the TriLUG mailing list