centos 最少安装时缺少semanage的,要这样装补上,因为默认是安装了SElinux的
[root@localhost ~]# sestatus SELinux status: enabled SELinuxfs mount: /selinux Current mode: enforcing Mode from config file: enforcing Policy version: 21 Policy from config file: targeted
要这样装上缺少的
yum install policycoreutils-python
然后改SSH配置
vi /etc/ssh/sshd_config
Port里加多一行
Port 2292
如果不要root登录就
PermitRootLogin no
保存后退出
semanage port -a -t ssh_port_t -p tcp 2292
firewall-cmd --permanent --zone=public --add-port=2292/tcp
firewall-cmd --reload
service sshd restart
然后搞定后以2292进去,把22端口去掉 再 service sshd restart