本文以centos系统为例:
1、关闭防火墙和selinux
1#关闭防火墙 2#centos 7 3systemctl stop firewalld 4#centos 6 5service iptables stop 6 7#关闭selinux 8vi /etc/selinux/config 9 10将SELINUX=enforcing改为SELINUX=disabled
2、修改sshd_config文件
1#Port修改为目标端口,如:2233 2vi /etc./ssh/sshd_config
3、重启sshd和查看状态
1#1、重启ssh 2#centos 7 3systemctl restart sshd.service 4#centos 6 5service sshd restart 6 7#2、查看sshd状态 8#centos 7 9systemctl status sshd.service 10#centos 6 11service sshd status
控制台显示:Active: active (running) 和 Server listening on port 2233 ,即表示修改成功