首页 > 其他 > 详细

系统安装后初始化脚本

时间:2016-04-11 07:35:07      阅读:166      评论:0      收藏:0      [点我收藏+]
#!/bin/bash
#Delete Users
for users in adm lp sync shutdown halt news uucp operator games gopher;
do
    userdel $users
done

#Delete Groups
for groups in adm lp news uucp games dip pppusers popusers slipusers;
do
    groupdel $groups
done

#Disable Services
for services in anacron auditd autofs avahi-daemon avahi-dnsconfd bluetooth cpuspeed firstboot gpm haldaemon hidd ip6tables ipsec isdn lpd mcstrans messagebus netfs nfs nfslock nscd pcscd portmap readahead_eraly restorecond rpcgssd rpcidmapd rstatd sendmail setroubleshoot yppasswdd ypserv;
do
    chkconfig $services off
done

#Clean Versions
echo "" > /etc/issue
echo "" > /etc/issue.net

#Add Warning
cat << EOF > /etc/motd
+-------------------------------------------------------------------------+
|Warning:                                                                 |
| You have to log in to a major server, all operations will be recorded.  |
|             Illegal operation shall be held liable!                     |
|                   Please carefully operation!                           |
+-------------------------------------------------------------------------+
EOF

#Disable Ctrl+alt+delete
sed -i ‘11s/^/#/‘ /etc/init/control-alt-delete.conf

#Add History config
cat << EOF >> /etc/profile
#history
USER_IP=\`who -u am i 2>/dev/null| awk ‘{print $NF}‘|sed -e ‘s/[()]//g‘\`
HISTDIR=/usr/share/.history
if [ -z $USER_IP ]
then
USER_IP=`hostname`
fi
if [ ! -d $HISTDIR ]
then
mkdir -p $HISTDIR
chmod 777 $HISTDIR
fi
if [ ! -d $HISTDIR/${LOGNAME} ]
then
mkdir $HISTDIR/${LOGNAME}
chmod 300 $HISTDIR/${LOGNAME}
fi
export HISTSIZE=4000
DT=\`date +"%Y%m%d_%H%M%S"\`
export HISTFILE="$HISTDIR/${LOGNAME}/${USER_IP}.history.$DT"
export HISTTIMEFORMAT="[%Y.%m.%d %H:%M:%S] "
chmod 600 $HISTDIR/${LOGNAME}/*.history* 2> /dev/null
EOF

本文出自 “毛竹之势” 博客,请务必保留此出处http://peaceweb.blog.51cto.com/3226037/1762395

系统安装后初始化脚本

原文:http://peaceweb.blog.51cto.com/3226037/1762395

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!