脚本内容:
#!/bin/bash
#welcome
cat << EOF
--------------------------------------------------------------
| ========= Welcome to Centos System init ========= |
----------------------Author:StoNe·J-------------------------
EOF
#disable ipv6
cat << EOF
--------------------------------------------------------------
| =========== Welcome to Disable IPV6 =========== |
--------------------------------------------------------------
EOF
echo "alias net-pf-10 off" >> /etc/modprobe.conf
echo "alias ipv6 off" >> /etc/modprobe.conf
/sbin/chkconfig ip6tables off
echo "ipv6 is disabled!"
#disable selinux
cat << EOF
--------------------------------------------------------------
| ========== Welcome to Disable Selinux========== |
--------------------------------------------------------------
EOF
if [ -s /etc/selinux/config ]; then
sed -i 's/SELINUX=enforcing/SELINUX=disabled/g' /etc/selinux/config
fi
echo "selinux is disabled,you must reboot!"
#set vim coloure
cat << EOF
--------------------------------------------------------------
| ========== Welcome to Set Vim Coloure========== |
--------------------------------------------------------------
EOF
sed -i "8 s/^/alias vi='vim'/" /root/.bashrc
echo 'syntax on' > /root/.vimrc
echo "set vim coloure is ok!"
# configure file max to 52100
cat << EOF
--------------------------------------------------------------
| ====== Welcome to Configure file max to 65535====== |
--------------------------------------------------------------
EOF
cat >>/etc/security/limits.conf<<eof
* soft nproc 65535
* hard nproc 65535
* soft nofile 65535
* hard nofile 65535
eof
cat >>/etc/sysctl.conf<<eof
fs.file-max=65535
eof
echo "configure file max to 52100 is ok!"
#seting ssh
cat << EOF
--------------------------------------------------------------
| =========== Welcome to Seting SSH =========== |
--------------------------------------------------------------
EOF
#disable UseDNS
sed -i "s/#UseDNS yes/UseDNS no/" /etc/ssh/sshd_config
/etc/init.d/sshd restart
echo "seting ssh is ok!"
#seting services
cat << EOF
--------------------------------------------------------------
| ========= Welcome to Seting SERVICES ========= |
--------------------------------------------------------------
EOF
SERVICES="acpid atd apmd avahi-daemon avahi-dnsconfd bluetooth capi cpuspeed cups dund firstboot hidd ip6tables isdn irda irattach mcstrans NetworkManager pcscd pand rawdevices sendmail sdpd yum-updatesd"
for service in $SERVICES
do
chkconfig $service off
service $service stop
done
@叨比叨
-------------------------
我在顶个
-------------------------
版权声明:本文内容由阿里云实名注册用户自发贡献,版权归原作者所有,阿里云开发者社区不拥有其著作权,亦不承担相应法律责任。具体规则请查看《阿里云开发者社区用户服务协议》和《阿里云开发者社区知识产权保护指引》。如果您发现本社区中有涉嫌抄袭的内容,填写侵权投诉表单进行举报,一经查实,本社区将立刻删除涉嫌侵权内容。