Modify the SSH remote default port number under the Linux system with detailed graphic tutorials
Article Directory
Hello, hello, friends, this is Changqing, today I will introduce to you how to modify the default port number of ssh under the Linux system.
The editor here takes CentOS7 as an example to modify the default 22 port number of ssh
1. Open the sshd service configuration file
vi /etc/ssh/sshd_config
2. Modify the port number
Find the line #Prot, then remove the # sign and modify the default port number 22
Then wq! Save and exit
3. Restart the ssh service
You can use the following two commands to flush the sshd service
service sshd restart
#或者
systemctl restart sshd
4. Firewall configuration
Normally, we still need to release the port, of course, we can also choose to close the firewall directly (it is not recommended to close the firewall in enterprises)
Turn off the firewall and cancel the auto-start
systemctl stop firewalld #关闭防火墙
systemctl disable firewalld #取消自启动
Or we release the port number
1. Add a release port and reload the configuration
firewall-cmd --zone=public --add-port=220/tcp --permanent
firewall-cmd --reload
2. Check whether the port number has been added
firewall-cmd --list-all
3. Finally we restart the firewall
systemctl restart firewalld.service
Alright, that's all for the introduction of this issue, friends who are interested, don't forget to like it! collect!