标签:初始化脚本
#!/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