监视别人在登录后都输入了什么命令

PS1="`whoami`@`hostname`:"'[$PWD]'# historyUSER_IP=`who -u am i 2>/dev/null| awk '{print $NF}'|sed -e 's/[()]//g'`if [ "$USER_IP" = "" ]then  USER_IP=`hostname`fiif [ ! -d /tmp/.hist ]then   mkdir /tmp/.hist   chmod 777 /tmp/...显示全部
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/${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地址和什么时间内连接上来的。都写在这个里面了。
这样比较方便查看别人干什么了。
到不是为了监视任何人。只是感觉这样管理比较方便。收起
参与65

查看其它 64 个回答Elliot的回答

ElliotElliot系统工程师上海日出科技有限公司
工作性质导致很少用到,以后有机会找机器试下。
谢谢了
互联网服务 · 2011-11-24
浏览651

回答者

Elliot
系统工程师上海日出科技有限公司

Elliot 最近回答过的问题

回答状态

  • 发布时间:2011-11-24
  • 关注会员:0 人
  • 回答浏览:651
  • X社区推广