useradd creates a log entry while appending to /etc/passwd does not

by FelixBauer
GNU/Linux ◆ foot-extra ◆ zsh 219 views

In this video I show how a log entry gets created when I use the command useradd while there isn’t when I directly append the necessary lines to /etc/passwd and /etc/shadow.

This could be a method to obtain persistence on a hacked machine and nicely shows why a trigger on “useradd” is good but there also should be one for suand logins.

In the example I don’t provide a password hash (which would be necessary to log in, e.g. via ssh)

You can use auditd to log any changes of the file (https://wiki.archlinux.org/title/Audit_framework#Audit_files_and_directories_access).