How do CentOS7 modify the SSH login port
- 2020-06-03 09:10:42
- OfStack
centos7 changes the default login port of ssh to be similar to centos6, that is, the firewall is not as good, and then selinux is best closed.
[Modify ssh default port 22]
vi /etc/ssh/sshd_config
Add a line below Port 22, for port 50000, Port 50000
Then save and restart ssh service systemctl restart sshd.service
[New port released in firewall]
firewall-cmd --permanent --add-port=50000/tcp
Query with this command
firewall-cmd --permanent --query-port=50000/tcp
If it was yes, it was added successfully; if it was no, it was unsuccessful
Successful reload firewall ES32en-ES33en? reload
[Close selinux]
View selinux status sestatus, if enabled is on
vi /etc/selinux/config
Modify SELINUX = disabled
Then restart vps and try to log in with the new 50000 port. If the login is successful, delete Port 22 and restart the ssh service.