oracle记录各登陆主机用户名,登陆ip,所执行的命令

/etc/profile

#history   
    USER_IP=`who -u am i 2>/dev/null| awk '{print $NF}'|sed -e 's/[()]//g'`
    HISTDIR=/usr/share/.history
    if [ -z $USER_IP ]
    then
    USER_IP=`hostname`
    fi
    if [ ! -d $HISTDIR ]
    then
    mkdir -p $HISTDIR
    chmod 777 $HISTDIR
    fi
    if [ ! -d $HISTDIR/${LOGNAME} ]
    then
    mkdir -p $HISTDIR/${LOGNAME}
    chmod 300 $HISTDIR/${LOGNAME}
    fi
    export HISTSIZE=4000
    DT=`date +%Y%m%d_%H%M%S`
    export HISTFILE="$HISTDIR/${LOGNAME}/${USER_IP}.history.$DT"
    export HISTTIMEFORMAT="[%Y.%m.%d %H:%M:%S]"
    chmod 600 $HISTDIR/${LOGNAME}/*.history* 2>/dev/null
View Code

相关文章:

  • 2021-09-01
  • 2021-07-24
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-08-29
  • 2022-12-23
猜你喜欢
  • 2022-01-16
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-11-19
  • 2022-12-23
相关资源
相似解决方案