修改配置文件

Text
vi /etc/ssh/sshd_config
#Port 22 
改为
Port 12345 #改为你想要更换的端口号

重启ssh服务

Text
systemctl restart sshd.service