修改/etc/ssh/sshd_config,在Port 22下添加你的端口,或者将22改为修改后的端口号 Port 22 Port YOUR_PORT 重启ssh service ssh restart 参考:Ubuntu 16.04修改ssh端口 - 南望孤笑 - 博客园