In Red Hat Enterprise Edition Linux5, how does one use audit to check who modified the file? -- Linux general technology-Linux technology and application information. For details, refer to the following section. When we create a security policy for a server, it is necessary to check whether the file is accidentally changed from time to time. Using tools such as md5sum, you can know that a file has been changed, but you don't know who changed the file. Using the audit subsystem, it is possible to track the processes that change the file.
Use the auditctl command to set monitoring for a file:
[Root @ host] # auditctl-w/etc/hosts-p war-k hosts-file
Here, a monitoring item is set on the/etc/hosts file to call any system that may execute write, read, or change the attribute (-p war) (syscall ). This will be recorded as key hosts-file. The key can be used to search for those operations in the audit log. Use the ausearch command: