SSH port ing

Source: Internet
Author: User
Tags ssh port

You can bind a port remote_port of the remote server to the local port, where-C is used for data compression and-f is used for background operations. Only when the user name and password are prompted can you switch to the front-end. -N is not used to execute remote commands. This command is useful when only port forwarding is performed. -G allows the remote host to connect to the local forwarding port. -R indicates that the remote host port is mapped to the local port. If it is-L, the local port is mapped to the remote host port.
 
Three powerful port forwarding commands of ssh:
 
Forward to the remote end: ssh-C-f-N-g-L local port: Target IP Address: Target Port username @ target IP Address
 
Forward to local: ssh-C-f-N-g-R local port: Target IP Address: Target Port username @ target IP Address
 
Ssh-C-f-N-g-D listen_port user @ Tunnel_Host
 
-C: compressed data transmission.
 
-F: the user/password for background authentication. It is usually used with-N and does not need to be logged on to the remote host.
 
-N: do not execute scripts or commands, usually used with-f.
 
-G: In the-L/-R/-D parameter, the remote host is allowed to connect to the established forwarding port. If this parameter is not added, only the local host is allowed to establish a connection.
 
-L local port: Target IP Address: Target Port
 
Forward a port of the Local Machine (client) to the specified port of the remote specified machine. the working principle is as follows: a socket listening port is allocated on the local machine. Once a connection is established on the port, the connection is forwarded through a secure channel, at the same time, the remote host establishes a connection with the host's hostport. you can specify port forwarding in the configuration file. only the root user can forward the privileged port. description of IPv6 address in another format: port/host/hostport
 
-R local port: Target IP Address: Target Port
 
Forward a port of the remote host (server) to the specified port of the local host. the working principle is as follows: a socket listening port is assigned to the remote host. Once a connection is established on the port, the connection goes through the secure channel, establish a connection between the local host and the host's hostport. you can specify port forwarding in the configuration file. only the root user can log on to the remote host to forward the privileged port. description of IPv6 address in another format: port/host/hostport
 
-P: the sshd service port of the logged-on ssd server.
 
-D port
 
Specifies a Local Machine "dynamic'' application port forwarding. the working principle is as follows: a socket listening port is allocated on the local machine. Once a connection is established on the port, the connection is forwarded through a secure channel, based on the application protocol, you can determine where the remote host will be connected. currently, the SOCKS4 protocol is supported and will act as the SOCKS4 server. only the root user can forward the privileged port. you can specify dynamic port forwarding in the configuration file.
 
Application Example
 
1. Forward the access from port 80 to port 8080 of 192.168.1.1.
 
Ssh-C-f-N-g-L 80: 192.168.1.1: 8080 user@192.168.1.1
 
2. It refers to port 80 forwarded to the local host through 8080 access to 192.168.1.1.
 
Ssh-C-f-N-g-R 80: 192.168.1.1: 8080 user@192.168.1.1
 

From Gaoming Columns

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.