Centos7修改SSH端口

编辑文件

vi /etc/ssh/sshd_config
取消 #Port 22 的注释,在下一行添加你需要修改的新端口 Port 2048。这里不删除 22 端口是为了防止修改后新端口无法访问,造成无法用 ssh 连接服务器。

修改保存 sshd_config

保存退出后重启 sshd 服务:
systemctl restart sshd

关闭防火墙

Centos7 使用命令:
systemctl stop firewalld.service

永久禁用防火墙

Centos7 使用命令:
systemctl disable firewalld.service

检测是否开启端口

用 ss 命令检查 ssh 监听的端口。
ss -tnlp | grep ssh

posted @ 2020-06-24 10:24  Fallin  阅读(209)  评论(0)    收藏  举报