Você pode acompanhar as alterações em um sistema de arquivos usando as auditd(8)
capablilities:
Um exemplo simples:
# mkdir /root/test
# auditctl -w /root/test/ -p wa
# touch test/foo
# rm -f test/foo
Os registros são mantidos em /var/log/audit/audit.log
e podem ser analisados posteriormente:
# tail /var/log/audit/audit.log
type=CONFIG_CHANGE msg=audit(1372668317.891:159): auid=0 ses=6 subj=unconfined_u:system_r:insmod_t:s0-s0:c0.c1023 op="add rule" key=(null) list=4 res=1
type=SYSCALL msg=audit(1372668344.279:160): arch=c000003e syscall=2 success=yes exit=3 a0=7fff4884994f a1=941 a2=1b6 a3=7fff48847900 items=2 ppid=3817 pid=5859 auid=0 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 ses=6 tty=pts3 comm="touch" exe="/bin/touch" subj=unconfined_u:system_r:insmod_t:s0-s0:c0.c1023 key=(null)
type=CWD msg=audit(1372668344.279:160): cwd="/root"
type=PATH msg=audit(1372668344.279:160): item=0 name="test/" inode=4271 dev=fe:01 mode=040700 ouid=0 ogid=0 rdev=00:00 obj=unconfined_u:object_r:user_home_t:s0
type=PATH msg=audit(1372668344.279:160): item=1 name="test/foo" inode=4723 dev=fe:01 mode=0100600 ouid=0 ogid=0 rdev=00:00 obj=unconfined_u:object_r:user_home_t:s0
type=SYSCALL msg=audit(1372668371.491:161): arch=c000003e syscall=263 success=yes exit=0 a0=ffffffffffffff9c a1=15850c0 a2=0 a3=7fff0e0cd790 items=2 ppid=3817 pid=5866 auid=0 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 ses=6 tty=pts3 comm="rm" exe="/bin/rm" subj=unconfined_u:system_r:insmod_t:s0-s0:c0.c1023 key=(null)
type=CWD msg=audit(1372668371.491:161): cwd="/root"
type=PATH msg=audit(1372668371.491:161): item=0 name="test/" inode=4271 dev=fe:01 mode=040700 ouid=0 ogid=0 rdev=00:00 obj=unconfined_u:object_r:user_home_t:s0
type=PATH msg=audit(1372668371.491:161): item=1 name="test/foo" inode=4723 dev=fe:01 mode=0100600 ouid=0 ogid=0 rdev=00:00 obj=unconfined_u:object_r:user_home_t:s0
# ausearch -m SYSCALL -ts recent
----
time->Mon Jul 1 10:45:44 2013
type=PATH msg=audit(1372668344.279:160): item=1 name="test/foo" inode=4723 dev=fe:01 mode=0100600 ouid=0 ogid=0 rdev=00:00 obj=unconfined_u:object_r:user_home_t:s0
type=PATH msg=audit(1372668344.279:160): item=0 name="test/" inode=4271 dev=fe:01 mode=040700 ouid=0 ogid=0 rdev=00:00 obj=unconfined_u:object_r:user_home_t:s0
type=CWD msg=audit(1372668344.279:160): cwd="/root"
type=SYSCALL msg=audit(1372668344.279:160): arch=c000003e syscall=2 success=yes exit=3 a0=7fff4884994f a1=941 a2=1b6 a3=7fff48847900 items=2 ppid=3817 pid=5859 auid=0 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 ses=6 tty=pts3 comm="touch" exe="/bin/touch" subj=unconfined_u:system_r:insmod_t:s0-s0:c0.c1023 key=(null)
----
time->Mon Jul 1 10:46:11 2013
type=PATH msg=audit(1372668371.491:161): item=1 name="test/foo" inode=4723 dev=fe:01 mode=0100600 ouid=0 ogid=0 rdev=00:00 obj=unconfined_u:object_r:user_home_t:s0
type=PATH msg=audit(1372668371.491:161): item=0 name="test/" inode=4271 dev=fe:01 mode=040700 ouid=0 ogid=0 rdev=00:00 obj=unconfined_u:object_r:user_home_t:s0
type=CWD msg=audit(1372668371.491:161): cwd="/root"
type=SYSCALL msg=audit(1372668371.491:161): arch=c000003e syscall=263 success=yes exit=0 a0=ffffffffffffff9c a1=15850c0 a2=0 a3=7fff0e0cd790 items=2 ppid=3817 pid=5866 auid=0 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 ses=6 tty=pts3 comm="rm" exe="/bin/rm" subj=unconfined_u:system_r:insmod_t:s0-s0:c0.c1023 key=(null)