抓住做怀事的家伙
vim /etc/profile
#history
export HISTTIMEFORMAT="[%Y.%m.%d %H:%M:%S]"
USER_IP=`who -u am i 2>/dev/null|awk '{print $NF}'|sed -e 's/[()]//g'`
HISTDIR=/var/log/.hist
if [ -z $USER_IP ]
then
USER_IP=`hostname`
fi
if [ ! -d $HISTDIR ]
then
mkdir -p $HISTDIR
chmod 777 $HISTDIR
fi
export HISTSIZE=4096
DT=`date +%Y%m%d_%H:%M:%S`
export HISTFILE="$HISTDIR/$DT.${LOGNAME}.${USER_IP}"
chmod 600 $HISTDIR/$DT.* 2>/dev/null
阅读(678) | 评论(0) | 转发(0) |