Centos修改SSH端口

HTML  2022-12-14 09:27  315  

1.编辑/etc/ssh/sshd_config

解开Port 22注释,保险起见保留22端口增加新端口,修改成功后再删除,然后保存

Port 22
Port 27374

2.如果开了SELinux,需要执行以下命令

# If you want to change the port on a SELinux system, you have to tell
# SELinux about this change.
semanage port -a -t ssh_port_t -p tcp #PORTNUMBER

3.防火墙放行新端口

4.测试链接,测试通过后删除22端口即可


发布于 2022-12-14 09:27, 最后修改于2022-12-14 09:27