1,linux操作日志记录,记录从各个ip登陆到系统的账号,指向命令及命令执行时间
#!/bin/bash
echo "export PROMPT_COMMAND=‘{ msg=\$(history 1 | { read x y; echo \$y; }); logger -p local5.info \"\$HOSTNAME [HIST] : \$SSH_CLIENT : \$PWD : \$msg\"; }‘" >> /etc/bashrc
echo export HISTTIMEFORMAT=\"[%F %T]\" >> /etc/bashrc
echo \# Save user log >> /etc/rsyslog.conf
echo local5.* /var/log/hist.log >> /etc/rsyslog.conf
service rsyslog restart
原文:http://www.cnblogs.com/ruiy/p/shellLinuxOpe.html