vi /etc/ssh/sshd_config #注意不是ssh_config
找到#port 22
这里去掉#,后面的22改成你要的端口即可
保存退出vi
/etc/init.d/sshd restart #重启sshd,即可
ubuntu系统是 sudo service ssh restart