I am trying to determine if the passwd file present in the location /etc/passwd in Linux contains any invalid data entries with the pwck command.
For example:
1) If my file contains this entry which is invalid due to the extra colon in the end - user1:x:1000:1000:user1,,,:/home/user1:/bin/bash:
sudo pwck -r /etc/passwd
This takes a no by default if invalid entries exist and shows other output as well
2) If my passwd file is correct syntactically but has user that does not have corresponding directories
sudo pwck -r /etc/passwd
user 'user1': directory '/var/xyz' does not exist
The exit values of both commands is 2 so I cannot distinguish if the user entry is invalid or there are directories for users that are non existent
I only want to identify an invalid entry in passwd file i.e if there is some extra character or syntactically wrongly added entry in the file