#!/bin/sh
if [[ `id -u` != "0" ]];then
echo "please run this script as root"
exit 1
fi
#Source function library
. /etc/init.d/functions
#yum
ConfigYum(){
cd /etc/yum/repos.d/
touch ou.repo
echo "[test]">>ou.repo
echo "name=test">>ou.repo
echo "baseurl=file:///rhel7.2">>ou.repo
echo "gpgcheck=0">>ou.repo
}
#iptables
Iptables(){
echo "close iptables"
cp /etc/selinux/config /etc/selinux/config.`date + "%Y+%m+%d_%H:%M:%S"`
systemctl stop iptables
systemctl disable iptables
sed -i 's/SELINUX=enables/SELINUX=disabled/' /etc/selinux/config
setenforce 0
grep SELINUX=disabled /etc/selinux/config
echo "Close selinux -OK and iptables -OK"
sleep 2
}
#SSH
Sshd(){
echo "SSH"
sed -i 's%#Port 22%Port 25163%'
sed -i 's%#PermitRootLogin yes%PermitRootLogin no%'
sed -i 's%#PermitEmptyPasswords no%PermitEmptyPasswords no%'
sed -i 's%#UseDNS yes%UseDNS no%'
systemctl reload sshd.service
}
Sshd
Iptables
ConfigYum
ps:找个工作好难啊