Last active
September 26, 2023 23:04
-
-
Save rponte/6417582 to your computer and use it in GitHub Desktop.
Opening a SSH tunnel
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# ssh -L <local_port>:<remote_ip>:<remote_port> <user>@<gateway_ip> | |
ssh -L 1433:192.168.1.4:1433 owner@google.com | |
# or if you want to run in background without tty | |
ssh -f -N -T -L 8080:localhost:80 owner@google.com |
More information about the arguments,
http://unix.stackexchange.com/questions/46235/how-does-reverse-ssh-tunneling-work
The other options are:
-f
tells ssh to background itself after it authenticates, so you don't have to sit around running something on the remote server for the tunnel to remain alive.-N
says that you want an SSH connection, but you don't actually want to run any remote commands. If all you're creating is a tunnel, then including this option saves resources.-T
disables pseudo-tty allocation, which is appropriate because you're not trying to create an interactive shell.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
More informations,
http://chamibuddhika.wordpress.com/2012/03/21/ssh-tunnelling-explained/