Main Page/IT/ssh

From Lewis Consultancy Wiki
< Main Page‎ | IT
Jump to: navigation, search

Set up a revserse tunnel to bypass NAT to a remote machine

Useful to log into a remote machine (remote) with account (remoteaccount) that is behind a NAT firewall.

Create an account on a machine on the Internet (middle.some.place) which is available from both sides and set a password:

useradd -s /bin/bash middleuser
passwd middleuser


From remote machine

ssh -R 10002:localhost:22 middleuser@middle.some.place

The remote user will log into the middle machine. The terminal must stay open for the duration of the connection.

if you're logged into the middle.some.place.... you can then do:

 ssh remoteaccount@localhost -P 10002

should present a login for the remote machine and that should be it!