hhnf333 发表于 2018-8-16 13:13:11

系统初始化SHELL脚本

#!/bin/bash  
# Created by kerryhu
  
# MAIL:king_819@163.com
  
# BLOG:http://kerry.blog.51cto.com
  
cat > /etc/crontab
  
service crond restart
  
#set ulimit
  
echo "ulimit -SHn 102400" >> /etc/rc.local
  
#set locale
  
#true > /etc/sysconfig/i18n
  
#cat >>/etc/sysconfig/i18n> /etc/sysctl.conf/etc/modprobe.conf
  
echo "alias ipv6 off" >> /etc/modprobe.conf
  
/sbin/chkconfig --level 35 ip6tables off
  
echo "ipv6 is disabled!"
  
#disable selinux
  
sed -i '/SELINUX/s/enforcing/disabled/' /etc/selinux/config
  
echo "selinux is disabled,you must reboot!"
  
#vim
  
sed -i "8 s/^/alias vi='vim'/" /root/.bashrc
  
echo 'syntax on' > /root/.vimrc
  
#zh_cn
  
sed -i -e 's/^LANG=.*/LANG="en"/'   /etc/sysconfig/i18n
  
#init_ssh
  
ssh_cf="/etc/ssh/sshd_config"
  
sed -i -e '74 s/^/#/' -i -e '76 s/^/#/' $ssh_cf
  
#sed -i "s/#Port 22/Port 65535/" $ssh_cf
  
sed -i "s/#UseDNS yes/UseDNS no/" $ssh_cf
  
#client
  
sed -i -e '44 s/^/#/' -i -e '48 s/^/#/' $ssh_cf
  
service sshd restart
  
echo "ssh is init is ok.............."
  
#chkser
  
#tunoff services
  
#--------------------------------------------------------------------------------
  
cat
页: [1]
查看完整版本: 系统初始化SHELL脚本