Ssh Setup a SSH Tunnel: Difference between revisions
Jump to navigation
Jump to search
Line 10: | Line 10: | ||
ssh -f -N [-p <''[[#remote-host-ssh-port|remote-host-ssh-port]]''>] [-i <''[[#identity-file|identity-file]]''>] \ | ssh -f -N [-p <''[[#remote-host-ssh-port|remote-host-ssh-port]]''>] [-i <''[[#identity-file|identity-file]]''>] \ | ||
[''[[#remote-host-ssh-user|remote-host-ssh-user]]'']@<''remote-host-address- | [''[[#remote-host-ssh-user|remote-host-ssh-user]]'']@<''[[#remote-host-address|remote-host-address]]''> -L <''local-port''>:<''remote-host-interface-to-forward-to''>:<''port-on-remote-host''> | ||
The "-f" option tells ssh to go to background. | The "-f" option tells ssh to go to background. | ||
Line 21: | Line 21: | ||
* <span id='identity-file'></span>-i <''identity-file''> may be used to specify a non-standard identity file, or the identity file for the remote user the connection is made for, if different from the local UNIX user that executes the command. | * <span id='identity-file'></span>-i <''identity-file''> may be used to specify a non-standard identity file, or the identity file for the remote user the connection is made for, if different from the local UNIX user that executes the command. | ||
* <span id='remote-host-ssh-user'></span>''remote-host-ssh-user'' the user on the remote system the SSH connection is made on behalf of. IF missing, the UNIX user executing the command is implied. | * <span id='remote-host-ssh-user'></span>''remote-host-ssh-user'' the user on the remote system the SSH connection is made on behalf of. IF missing, the UNIX user executing the command is implied. | ||
* <span id='remote-host-address'></span>''remote-host-address'' the address of the remote system that runs the sshd daemon. |
Revision as of 03:03, 27 December 2018
Internal
Overview
OpenSSH can be used to tunnel traffic from the local host to a remote host you have an account on.
Setting a Tunnel from a Local Port to a Port on a Remote Host
ssh -f -N [-p <remote-host-ssh-port>] [-i <identity-file>] \ [remote-host-ssh-user]@<remote-host-address> -L <local-port>:<remote-host-interface-to-forward-to>:<port-on-remote-host>
The "-f" option tells ssh to go to background.
The "-N" option tells ssh to NOT execute any command on the remote system. If "-N" is omitted, the ssh tunnel will establish AND login.
The meaning of other arguments is the following:
- -p <remote-host-ssh-port> may be used to specify a non-standard SSH port, if the SSH daemon on the remote host was configured to listen on a port other than 22.
- -i <identity-file> may be used to specify a non-standard identity file, or the identity file for the remote user the connection is made for, if different from the local UNIX user that executes the command.
- remote-host-ssh-user the user on the remote system the SSH connection is made on behalf of. IF missing, the UNIX user executing the command is implied.
- remote-host-address the address of the remote system that runs the sshd daemon.