First of all, let's briefly explain why we need to modify SSH remote port number.
After we have installed the system, the SSH remote port of Linux is 22 port by default, but due to security considerations, we usually consider changing the original 22 port to another port after installing the system.
This article will take the port to 60022 as an example, explain the specific operation process. (This port number, you can change according to your own needs, this article takes 60022 as an example.) )
[Email protected] ~]$ Vi/etc/ssh/sshd_config
after executing the last command, you can see the configuration page and find Port22 , and then the port A Change the port number you want or add a line below Port 60022 (This is the pilot port), the system defaults to A port, if you add a port, the default port will become invalid, the system will set the port as SSH the port number of the connection.
650) this.width=650; "Src=" Http://s3.51cto.com/wyfs02/M00/84/57/wKioL1eN1nqyvFIEAAA77QJ6pTo268.png-wh_500x0-wm_3 -wmp_4-s_2738349607.png "title=" 30.png "alt=" Wkiol1en1nqyvfieaaa77qj6pto268.png-wh_50 "/>
Save exit after the modification is complete.
[email protected] ~]$/etc/init.d/sshd Restart// Restart sshd service can be.
[email protected] ~]$ sshlocalhost-p 60022// connection test, test success.
If you want to be safe, you cannot use a port because it is not connected (such as under attack)SSHconnection, you can use multipleSSHconnection port. The specific configuration method is also in the configuration file/etc/ssh/sshd_configin the change, runVi/etc/ssh/sshd_config, findPortport number Place, and then add a line below:Port2323, this adds a new connection port and restartsSSHServices,
Test ssh localhost-p 2323 , the connection is successful.
Note :
If there is no problem with the native test, you cannot use the third place Connection tool from the external SSH link, see if the firewall shuts down, shuts down the firewall, restarts SSHD service, and that's it.
This article is from the "Jiaao" blog, make sure to keep this source http://jiaao.blog.51cto.com/10894904/1827781
Linux Modify SSH remote port