Linux system ssh connection outgoing and incoming port settings

The ssh port settings are divided into connection-in and connection-out port settings:

1. If you want to set the port number for connection, enter the directory vim /etc/ssh/sshd_config, and modify the corresponding port number to 36000, as shown in the figure below.

 2. If you want to set the outgoing port number, that is, if you use ssh root@IP without adding the -p parameter, you must also connect according to the default port number 36000 you want. Then enter the directory vim /etc/ssh/ssh_config, and modify the corresponding port number to 36000, as shown in the figure below.

3. After the first step and the second step are modified, restart the ssh server, systemctl restart network.service can be used normally, that is: ssh root@IP without the -p parameter, can also connect to port 36000 by default.

Guess you like

Origin blog.csdn.net/weixin_42132076/article/details/130314649