centOS 7 換ssh埠
阿新 • • 發佈:2018-12-21
centos 最少安裝時缺少semanage的,要這樣裝補上,因為預設是安裝了SElinux的
[[email protected] ~]# 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