Skip to content

Instantly share code, notes, and snippets.

@neuralvis
Last active January 5, 2021 01:36
Show Gist options
  • Save neuralvis/2fe26ee7c5270fc8bda36b1259515f57 to your computer and use it in GitHub Desktop.
Save neuralvis/2fe26ee7c5270fc8bda36b1259515f57 to your computer and use it in GitHub Desktop.
Tips and Tricks with SSH

Setting up a reverse SSH Tunnel

ssh -N -R 2210:localhost:22 username@host.com

This command can be interpreted as, create a tunnel between the remote host's port 2210 and localhost:22, where the remote host is host.com.

-R implies that the tunnel will be used from the remote side - i.e. host.com.

This command will initiate an ssh connection with reverse port forwarding option which will then open listening port :2210 on host.com who is going to be forwarded back to localhost's port :22 and all this will happen on the remote computer username@host.com

Setting up a forward SSH Tunnel

ssh -N -L 2210:node003:22 username@host.com

This command can be interpreted as, create a tunnel between the current host's port 2210 and node003:22 of host.com.

-L implies that the tunnel will be used from the host that initiated the tunnel.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment