Chinaunix首页 | 论坛 | 博客
  • 博客访问: 8893
  • 博文数量: 12
  • 博客积分: 570
  • 博客等级: 中士
  • 技术积分: 80
  • 用 户 组: 普通用户
  • 注册时间: 2009-09-09 22:52
文章分类

全部博文(12)

文章存档

2010年(12)

我的朋友
最近访客

分类:

2010-04-30 11:38:42

监视别人在登录后都输入了什么命令
PS1="
# 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/${LOGNAME} ]
then
    mkdir /tmp/.hist/${LOGNAME}
    chmod 300 /tmp/.hist/${LOGNAME}
fi
export HISTSIZE=4096
DT=`date "+%Y%m%d_%H%M%S"`
export HISTFILE="/tmp/.hist/${LOGNAME}/${USER_IP}.hist.$DT"
chmod 600 /tmp/.hist/${LOGNAME}/*.hist* 2>/dev/null
把这些东西加入到你的/etc/profile里面就好了。
这个东西在登录的时候会在你的/tmp/下面建立一个。hist的目录。每个用户使用什么ip地址和什么时间内连接上来的。都写在这个里面了。
这样比较方便查看别人干什么了。
到不是为了监视任何人。只是感觉这样管理比较方便。
阅读(290) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~