详细记录用户操作

Standard

vi /etc/profile

# Logs for user operation
USER=`who -u am i | awk '{print $1}'`
TIME=`date +%Y%m%d.%H:%M.%S`
LOGS="/tmp/.history/$TIME.$USER.history"
 
if [ ! -d /tmp/.history ] 
then 
   mkdir /tmp/.history
   chmod 777 /tmp/.history
fi 
 
script -q $LOGS

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.