#!/bin/bash
setenforce 0
`sed -i 's/SELINUX=enforcing/SELINUX=disabled/g' /etc/sysconfig/selinux` > /dev/null 2>&1	
`sed -i 's/SELINUX=enforcing/SELINUX=disabled/g' /etc/selinux/config` > /dev/null 2>&1
echo "selinux 已关闭。"
`systemctl start firewalld` 2>/dev/null
echo "firewald 已启动"
read -p "please input your port(30000-60000):" SSH_port
echo "您输入的端口是：$SSH_port"
`firewall-cmd --permanent --zone=public --add-port=${SSH_port}/tcp` > /dev/null 2>&1
`firewall-cmd --reload` > /dev/null 2>&1
SSH_port1=`awk 'NR==17{print}' /etc/ssh/sshd_config`
sed -i "s/$SSH_port1/Port ${SSH_port}/g" /etc/ssh/sshd_config
systemctl restart sshd
rm $0