我需要识别一个定期写入日志文件的守护进程。问题是我不知道哪个流程正在完成这项工作,我需要明天向客户展示一些进展。有人有任何线索吗?
我已经在PPID的帮助下整理了系统中运行的守护程序进程。任何帮助将不胜感激。
此外,我认为守护进程不可能(很少)没有PPID为1.我们怎么能找到它呢?
答案 0 :(得分:7)
答案 1 :(得分:4)
lsof
给出了包含进程的打开文件列表。
所以lsof | grep <filename>
可以帮到你。
答案 2 :(得分:2)
您可以使用auditctl。
# sudo apt-get install auditd
# sudo /sbin/auditctl -w /path/to/file -p war -k hosts-file
-w watch /etc/hosts
-p warx watch for write, attribute change, execute or read events
-k hosts-file is a search key.
# sudo /sbin/ausearch -f /path/to/file | more
提供
等输出type = UNKNOWN [1327] msg = audit(1459766547.822:130):proctitle = 2F7573722F7362696E2F61706163686532002D6B007374617274 type = PATH msg = audit(1459766547.822:130):item = 0 name =&#34; / path / to / file&#34; inode = 141561 dev = 08:00模式= 0100444 ouid = 33 ogid = 33 rdev = 00:00 nametype = NORMAL type = CWD msg = audit(1459766547.822:130):cwd =&#34; /&#34; type = SYSCALL msg = audit(1459766547.822:130):arch = c000003e syscall = 2 success = yes exit = 41 a0 = 7f3c23034cd0 a1 = 80000 a2 = 1b6 a3 = 8 items = 1 ppid = 24452 pid = 6797 auid = 42949672 95 uid = 33 gid = 33 euid = 33 suid = 33 fsuid = 33 egid = 33 sgid = 33 fsgid = 33 tty =(none)ses = 4294967295 comm =&#34; apache2&#34; EXE =&#34; / usr / sbin目录/ apache2的&#34;键=&#34;主机文件&#34;