1、编辑sshd_config
nano /etc/ssh/sshd_config
2、找到:Include /etc/ssh/sshd_config.d/*.conf
在“Include /etc/ssh/sshd_config.d/*.conf“”下面添加两行
port 22
port 33(随意设定端口别冲突就行,2-4位数都可以)
3、在"Include /etc/ssh/sshd_config.d/*.conf"前面加#号
4、重启vps
5、使用新加的端口号登录
6、登录成功后按上面步骤重新操作,在“port 22”前加#
7、重启vps
8、查看变更状态
systemctl status sshd
成功
555
1
1
555
1
1
555
1
555
1
1