码迷,mamicode.com
首页 > 其他好文 > 详细

更改ssh远程登录端口.sh

时间:2016-10-11 10:46:29      阅读:119      评论:0      收藏:0      [点我收藏+]

标签:

#!/bin/bash
#liu_dong

sed -i "s/\#Port 22/Port 31961/g" /etc/ssh/sshd_config 
sed -i "s/\#UseDNS yes/UseDNS no/g" /etc/ssh/sshd_config
sed -i "s/GSSAPIAuthentication yes/GSSAPIAuthentication no/g" /etc/ssh/sshd_config
sed -i "s/\#PermitRootLogin yes/PermitRootLogin no/g" /etc/ssh/sshd_config
systemctl restart sshd.service

#install semanage
yum -y install policycoreutils-python
semanage port -a -t ssh_port_t -p tcp 31961
systemctl restart sshd.service

#firewall
firewall-cmd --permanent --zone=public --add-port=80/tcp
firewall-cmd --permanent --zone=public --add-port=31961/tcp
firewall-cmd --permanent --zone=trusted --change-interface=enp7s0f1
firewall-cmd --reload

 

更改ssh远程登录端口.sh

标签:

原文地址:http://www.cnblogs.com/liuyansheng/p/5947995.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!