看看最后的过程感动文件 [英] See what process last touched a file

查看:116
本文介绍了看看最后的过程感动文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Linux中,有一些过程定期更换的目录和文件的权限,每天大概。这不是我设置了一个过程,我不知道它是什么。

On a linux box that there is some process regularly changing permissions on directories and files, roughly daily. This is not a process that I set up and I have no idea what it is.

我有root权限,我可以很容易地手动更改权限,以访问回来,但它是一个有点讨厌。

I have root access and I can easily change permissions manually to get access back but it is a bit annoying.

有没有办法看到的已经触及最后一个文件的进程列表?或者可以选择我将如何去有关文件的记录过程的活动。

Is there an way to see a list of processes that have last touched a file? Or alternatively how would I go about logging process activity on the file.

推荐答案

在一个Fedora系统,你可以使用:

On a Fedora system, you can use:

sudo auditctl -p a -w /some/file  # monitor attribute changes to /some/file

这是在审核包,如果你没有这样的安装,那么须藤yum的安装审核

It's in the audit package, if you don't have that installed, then sudo yum install audit

输出进入 /var/log/audit/audit.log 形式:

  type=SYSCALL msg=audit(1325185116.524:1133): arch=c000003e syscall=2 success=yes exit=3 a0=671600 a1=241 a2=1b6 a3=9 items=1 ppid=26641 pid=26643 auid=501 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=pts0 ses=1 comm="jmacs" exe="/usr/bin/joe" subj=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023 key=(null)
  type=CWD msg=audit(1325185116.524:1133):  cwd="/tmp"
  type=PATH msg=audit(1325185116.524:1133): item=0 name="/etc/passwd" inode=531545 dev=fd:01 mode=0100644 ouid=0 ogid=0 rdev=00:00 obj=system_u:object_r:etc_t:s0

这是一个有点迟钝,但要注意的味精=审计(###)串多行排队。


  • 现在,我确实阅读了有史以来第一次的手册页,我看到有关使用一些注意事项 -Farch = B32 / -Farch = B64 ,如此看来,有一些可能的怪事约32位-VS-64位的系统调用,因此,如果你没有得到审计命中,这可能是为什么。我从来没有真正见过这一点,但我还没有真正运行以来的速龙时代的32位进程,所以我不能把它说得很好。

  • Now that I actually read the manpage for the first time ever, I see some cautions about using -Farch=b32/-Farch=b64, so it seems that there is some possible weirdness about 32-bit-vs-64-bit syscalls, so if you don't get an audit hit, that might be why. I've never really seen this bit before, but I haven't really run any 32-bit processes since the Athlon era, so I can't speak to it very well.

这篇关于看看最后的过程感动文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆