修改SSH配置文件
[[email protected] ~]# vim /etc/ssh/sshd_config Port 22 #默认是注释掉的,取消注释 Port 60022 #插入一行,不要删除22端口,一定要等该端口测试OK,才能删除22端口
重启sshd服务
[[email protected] ~]# systemctl restart sshd
查看sshd服务端口
[[email protected] ~]# netstat -antup | grep sshd tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 19964/sshd tcp 0 0 0.0.0.0:60022 0.0.0.0:* LISTEN 19964/sshd_config
注意:如果开了防火墙的请把新的ssh接口添加到防火墙
然后用新接口登录测试,如果都正常,就可以修改配置文件把22接口注释或者删除了
发表评论