首页 > 代码库 > 更改ssh远程登录端口.sh

更改ssh远程登录端口.sh

#!/bin/bash#liu_dongsed -i "s/\#Port 22/Port 31961/g" /etc/ssh/sshd_config sed -i "s/\#UseDNS yes/UseDNS no/g" /etc/ssh/sshd_configsed -i "s/GSSAPIAuthentication yes/GSSAPIAuthentication no/g" /etc/ssh/sshd_configsed -i "s/\#PermitRootLogin yes/PermitRootLogin no/g" /etc/ssh/sshd_configsystemctl restart sshd.service#install semanageyum -y install policycoreutils-pythonsemanage port -a -t ssh_port_t -p tcp 31961systemctl restart sshd.service#firewallfirewall-cmd --permanent --zone=public --add-port=80/tcpfirewall-cmd --permanent --zone=public --add-port=31961/tcpfirewall-cmd --permanent --zone=trusted --change-interface=enp7s0f1firewall-cmd --reload

 

更改ssh远程登录端口.sh