如果没有auditd的话,使用yum安装安装即可
以linux监控/tmp/xxx.dat为例:
# vi /etc/audit/audit.rules
# whenever the audit daemon is started via the initscripts.
# The rules are simply the parameters that would be passed
# to auditctl.
# First rule - delete all
-D
# Increase the buffers to survive stress events.
# Make this bigger for busy systems
-b 320
# Feel free to add below this line. See auditctl man page
-w /tmp/xxx.dat -p wa
修改完成后重启auditd服务
# service auditd restart
默认监控输出的文件是 /var/log/audit/audit.log
你也可以使用ausearch来过滤搜索audit.log文件。例如:
# ausearch -f /tmp/xxx.dat
----
time->Fri Dec 25 10:39:36 2015
type=PATH msg=audit(1451011176.268:17610): item=1 name="/tmp/xxx.dat" inode=525492 dev=fd:00 mode=0100644 ouid=0 ogid=0 rdev=00:00
type=PATH msg=audit(1451011176.268:17610): item=0 name="/tmp/" inode=524289 dev=fd:00 mode=041777 ouid=0 ogid=0 rdev=00:00
type=CWD msg=audit(1451011176.268:17610): cwd="/home/slview/test/wsc"
type=SYSCALL msg=audit(1451011176.268:17610): arch=c000003e syscall=2 success=yes exit=3 a0=1b89f20 a1=241 a2=1b6 a3=3fc1b1dc10 items=2 ppid=13913 pid=13977 auid=0 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=pts8 ses=1778 comm="test.pl" exe="/usr/bin/perl" key=(null)
如果你在使用ausearch过滤不出来内容时,可以直接打开audit.log文件自己找。