In old good Sun Solaris days, one can use test /etc/passwd file integrity with the pwck command. The pwck command scans the password file and notes any inconsistencies. The checks include validation of the number of fields, login name, user ID, group ID, and whether the login directory and the program-to-use-as-shell exist.
Linux commands to check and verify integrity of password files
Check integrity of group file /etc/group with the grpck command command:
# echo $?
To check integrity of password file /etc/passwd and /etc/shadow file with pwck the command:
user 'lp': directory '/var/spool/lpd' does not exist user 'news': directory '/var/spool/news' does not exist user 'uucp': directory '/var/spool/uucp' does not exist user 'list': directory '/var/list' does not exist user 'irc': directory '/var/run/ircd' does not exist user 'gnats': directory '/var/lib/gnats' does not exist user 'nobody': directory '/nonexistent' does not exist pwck: no changes