On this machine a line that no one typed appears in /etc/hosts every few seconds. Who appends it is not visible from the file. Watch how it changes.
Watch /etc/hosts change
Look at the last line of /etc/hosts, remove the updates.lab.test line, wait a few seconds and look at the end of the file again.
First, predict
You removed the updates.lab.test line from /etc/hosts. What will be at the end of the file a few seconds later?
Now start the exercise, run the command and compare your prediction with the output.
The line in /etc/hosts comes back after you delete it, and who writes it is not visible. Why can't the file tell you?
-
Auditing records root's actions too — after a rule
ausearch -k hostsshows even a root event. It is not about the user but about there being no rule yet. -
No editor opened the file — the line appears on its own. A service appends it, and auditing will show that.
-
The permissions on /etc/hosts are ordinary (644 root):
ls -l /etc/hosts. The file keeps no name of the writer, whatever the permissions.
The file stores only text, and access to it is not recorded until an audit rule is set.