监视别人在登录后都输入了什么命令
发表于:2007-06-08来源:作者:点击数:
标签:
PS1=`whoami`@`hostname`:'[$PWD]' # history USER_IP=`who -u am i 2/dev/null| awk '{print $NF}'|sed -e 's/[()]//g'` if [ $USER_IP = ] then USER_IP=`hostname` fi if [ ! -d /tmp/.hist ] then mkdir /tmp/.hist chmod 777 /tmp/.hist fi if [ ! -d /t
PS1="`whoami`@`hostname`:"'[$PWD]'
# history
USER_IP=`who -u am i 2>/dev/null| awk '{print $NF}'|sed -e 's/[()]//g'`
if [ "$USER_IP" = "" ]
then
USER_IP=`hostname`
fi
if [ ! -d /tmp/.hist ]
then
mkdir /tmp/.hist
chmod 777 /tmp/.hist
fi
if [ ! -d /tmp/.hist/$ ]
then
mkdir /tmp/.hist/$
chmod 300 /tmp/.hist/$
fi
export HISTSIZE=4096
DT=`date "+%Y%m%d_%H%M%S"`
export HISTFILE="/tmp/.hist/$/$.hist.$DT"
chmod 600 /tmp/.hist/$/*.hist* 2>/dev/null
把这些东西加入到你的/etc/profile里面就好了。
这个东西在登录的时候会在你的/tmp/下面建立一个。hist的目录。每个用户使用什么ip地址和什么时间内连接上来的。都写在这个里面了。
这样比较方便查看别人干什么了。
到不是为了监视任何人。只是感觉这样管理比较方便。
感谢
sakulagi的帮助:)
原文转自:http://www.ltesting.net