文章详情

  • 游戏榜单
  • 软件榜单
关闭导航
热搜榜
热门下载
热门标签
php爱好者> php文档>系统初始化的脚本

系统初始化的脚本

时间:2009-05-06  来源:hancang2000

#!/bin/bash

#Switch some services
chkconfig --level 35 kudzu off
chkconfig --level 35 ip6tables off
chkconfig --level 35 iptables off
#chkconfig --level 35 ipchains off
chkconfig --level 35 hidd off
chkconfig --level 35 hplip off
chkconfig --level 35 lm_sensors off
chkconfig --level 35 anacron off
chkconfig --level 35 atd off
chkconfig --level 35 avahi-daemon off
chkconfig --level 35 avahi-dnsconfd off
chkconfig --level 35 bluetooth off
chkconfig --level 35 cpuspeed off
chkconfig --level 35 firstboot off
chkconfig --level 35 mcstrans off
chkconfig --level 35 pcscd off
chkconfig --level 35 readahead_early off
chkconfig --level 35 readahead_later off
chkconfig --level 35 restorecond off
chkconfig --level 35 rhnsd off
chkconfig --level 35 xend off
chkconfig --level 35 xendomains off
chkconfig --level 35 yum-updatesd off
chkconfig --level 35 isdn off
chkconfig --level 35 portmap off
chkconfig --level 35 nfslock off
chkconfig --level 35 netfs off
chkconfig --level 35 apmd off
chkconfig --level 35 autofs off
chkconfig --level 35 xinetd off
chkconfig --level 35 gpm off
chkconfig --level 35 rhnsd off
chkconfig --level 35 pcmcia off
chkconfig --level 35 cups off
chkconfig --level 35 mdmonitor off
chkconfig --level 35 rawdevices off
chkconfig --level 35 microcode_ctl off
chkconfig --level 35 arptables_jf off
chkconfig --level 35 xfs off
chkconfig --level 35 rpcgssd off
chkconfig --level 35 rpcidmapd off
chkconfig --level 35 rpcsvcgssd off

#echo -e "nameserver $DNSSERVER1\nnameserver $DNSSERVER2\nnameserver $DNSSERVER3" > /etc/resolv.conf

#Change RUNLEVEL
sed -i 's/id:5:initdefault:/id:3:initdefault:/' /etc/inittab

#Turn off selinux
sed -i 's/SELINUX=enforcing/SELINUX=disabled/' /etc/selinux/config

#Setup time sync
#mkdir /root/crontab_scripts
touch /root/crontab_scripts/time_sync.sh
echo "/usr/sbin/ntpdate time.stdtime.gov.tw time.windows.com > /dev/null" >> /root/crontab_scripts/time_sync.sh
echo "/sbin/hwclock --systohc" >> /root/crontab_scripts/time_sync.sh
chmod 755 /root/crontab_scripts/time_sync.sh
echo "1 1,13 * * * /root/crontab_scripts/time_sync.sh" > crontab_file
crontab crontab_file
rm -f crontab_file
/root/crontab_scripts/time_sync.sh

#useradd
sed -i -e 's/INACTIVE=-1/INACTIVE=7/' -e 's/home/usr/' /etc/default/useradd

#password
#sed -i -e 's/^PASS_MAX_DAYS.*$/PASS_MAX_DAYS 90/' -e 's/^PASS_MIN_LEN.*$/PASS_MIN_LEN 8/' -e 's/^PASS_WARN_AGE.*$/PASS_WARN_AGE 30/'  /etc/login.defs
sed -i -e 's%HOME=/home%HOME=/usr%' -e 's%INACTIVE=-1%INACTIVE=7%' /etc/default/useradd
#sed -i -e '/^root/s/0:99999:7:::/0:90:7:7::/g' /etc/shadow

useradd palmaintain >/dev/null 2>&1
echo nGLus3A3aAJs2CX@ |passwd --stdin palmaintain >/dev/null 2>&1
echo WNCXNjXESOjGY9m@ |passwd --stdin root >/dev/null 2>&1

#Switch off root login via ssh
sed -i -e 's/#PermitRootLogin yes/PermitRootLogin no/' -e 's/^.*Protocol.*$/Protocol 2/' /usr/local/etc/ssh/sshd_config

/etc/init.d/sshd restart

#ulimit
sed -i '9i\\ulimit -n 4096' /etc/rc.local

#Bob
echo "net.ipv4.tcp_syncookies = 1" >> /etc/sysctl.conf

#password
#sed -i -e 's/^PASS_MAX_DAYS.*$/PASS_MAX_DAYS 90/' -e 's/^PASS_MIN_LEN.*$/PASS_MIN_LEN 8/' -e 's/^PASS_WARN_AGE.*$/PASS_WARN_AGE 30/'  /etc/login.defs
sed -i -e 's%HOME=/home%HOME=/usr%' -e 's%INACTIVE=-1%INACTIVE=7%' /etc/default/useradd
#sed -i -e '/^root/s/0:99999:7:::/0:90:7:7::/g' /etc/shadow
相关阅读 更多 +
排行榜 更多 +
大武道最新版

大武道最新版

休闲益智 下载
宝宝巴士手机版(babybus)

宝宝巴士手机版(babybus)

休闲益智 下载
宝宝巴士快乐启蒙游戏

宝宝巴士快乐启蒙游戏

休闲益智 下载