history記錄中添加時間,用戶地址等信息html
vi /etc/profilelinux
export HISTTIMEFORMAT=" %F %T `who -u am i 2> /dev/null | awk '{print $NF}' | sed -e 's/[()]//g'` `whoami` "web
history記錄添加到 syslog日誌bash
vi /etc/profile
ide
export PROMPT_COMMAND=' history -a >(tee -a ~/.bash_history | logger -t "$USER[$$] $SSH_CONNECTION") '
日誌
source /etc/profilehtm
參考:get
https://backdrift.org/logging-bash-history-to-syslog-using-traps
it
http://webplay.pro/linux/syslog-log-bash-history-every-user.html class