Chinaunix首页 | 论坛 | 博客
  • 博客访问: 6545566
  • 博文数量: 1005
  • 博客积分: 8199
  • 博客等级: 中将
  • 技术积分: 13071
  • 用 户 组: 普通用户
  • 注册时间: 2010-05-25 20:19
个人简介

脚踏实地、勇往直前!

文章分类

全部博文(1005)

文章存档

2020年(2)

2019年(93)

2018年(208)

2017年(81)

2016年(49)

2015年(50)

2014年(170)

2013年(52)

2012年(177)

2011年(93)

2010年(30)

分类: AIX

2013-07-23 16:33:41


如下脚本可以实现查看登录用户的所有操作.

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地址和什么时间内连接上来的,都写在这个里面了.
阅读(3774) | 评论(1) | 转发(0) |
给主人留下些什么吧!~~