Publish: 2014-11-07 | Modify: 2014-11-07
Linux SSH default port is 22. For security reasons, it is necessary to modify the port to prevent malicious scanning by bots. Now, let's modify the port to 50000.
The method to modify the port is as follows:
vi /etc/ssh/sshd_config
.Port 22
and change it to Port 50000
./usr/sbin/sshd -p 50000
to specify the port.After making the changes, restart the sshd service using the command service sshd restart
.
[root@localhost /]# vi /etc/ssh/sshd_config
Port 50000
[root@localhost /]# /usr/sbin/sshd -p 50000
[root@localhost /]# service sshd restart
Stopping sshd: [ OK ]
Starting sshd: [ OK ]
If you want to open both port 22 and 50000, you can add an additional line in /etc/ssh/sshd_config as follows:
[root@localhost /]# vi /etc/ssh/sshd_config
Port 22
Port 60000
Save the file and exit.
I come from China and I am a freelancer. I specialize in Linux operations, PHP, Golang, and front-end development. I have developed open-source projects such as Zdir, ImgURL, CCAA, and OneNav.