linux用户登陆记录脚本
2017-11-22 17:03
218 查看
#log_history
#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/dbasky ]
then
mkdir /tmp/dbasky
chmod 777 /tmp/dbasky
fi
if [ ! -d /tmp/dbasky/${LOGNAME} ]
then
mkdir /tmp/dbasky/${LOGNAME}
chmod 300 /tmp/dbasky/${LOGNAME}
fi
export HISTSIZE=4096
DT=`date "+%Y-%m-%d_%H:%M:%S"`
export HISTFILE="/tmp/dbasky/${LOGNAME}/${USER_IP} dbasky.$DT"
chmod 600 /tmp/dbasky/${LOGNAME}/*dbasky* 2>/dev/null
#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/dbasky ]
then
mkdir /tmp/dbasky
chmod 777 /tmp/dbasky
fi
if [ ! -d /tmp/dbasky/${LOGNAME} ]
then
mkdir /tmp/dbasky/${LOGNAME}
chmod 300 /tmp/dbasky/${LOGNAME}
fi
export HISTSIZE=4096
DT=`date "+%Y-%m-%d_%H:%M:%S"`
export HISTFILE="/tmp/dbasky/${LOGNAME}/${USER_IP} dbasky.$DT"
chmod 600 /tmp/dbasky/${LOGNAME}/*dbasky* 2>/dev/null
相关文章推荐
- 通过登陆IP记录Linux所有用户登录所操作的日志
- linux 利用wtmp 日志记录并分析用户登陆统计
- linux - 用户登陆自加载脚本
- Linux下查看用户登陆后的操作记录的方法
- 按时按登录IP记录Linux所有用户操作日志的方法(附脚本)
- 在Linux下记录所有用户的登录和操作日志(脚本)
- Linux下查看用户登陆后的操作记录
- Linux 用户登录后操作记录脚本
- Linux下查看用户登陆后的操作记录
- Linux查看用户登陆历史记录
- Linux下查看用户登陆后的操作记录及history命令显示时间
- 通过登陆IP记录Linux所有用户登录所操作日志的方法
- Linux下记录所有用户操作的脚本
- Linux下查看用户登陆后的操作记录及history命令显示时间
- Linux查看用户登陆历史记录
- 按时按登录IP记录Linux所有用户操作日志的方法(附脚本)
- Linux下查看用户登陆后的操作记录
- 通过登陆IP记录Linux所有用户登录所操作的日志
- Linux查看用户登陆历史记录 原文出自【比特网】,转载请保留原文链接:http://soft.chinabyte.com/os/49/12395049.shtml
- linux下在root用户登陆状态下,以指定用户运行脚本程序实现方式