在/etc/profile中添加下面内容:
export LC_ALL=C
TMOUT=3600
HISTFILESIZE=2000
HISTSIZE=2000
HISTTIMEFORMAT="%Y%m%d-%H%M%S:"
export HISTTIMEFORMAT
export PROMPT_COMMAND='{ command=$(history 1 | { read x y; echo $y; });
logger -p local1.notice -t bash -i "user=$USER,ppid=$PPID,from=$SSH_CLIENT,pwd=$PWD,command:$command"; }'
添加完之后,重新加载该文件 source /etc/profile
这样在/var/log/message中会记录用户的shell命令

 

相关文章:

  • 2022-02-20
  • 2021-09-23
  • 2021-09-24
  • 2022-12-23
  • 2021-12-31
  • 2021-08-23
  • 2021-10-02
  • 2021-06-26
猜你喜欢
  • 2021-12-21
  • 2022-12-23
  • 2022-12-23
  • 2022-01-11
  • 2022-12-23
  • 2022-12-23
  • 2021-05-09
相关资源
相似解决方案