Handle error : mismatch in /etc/passwd and /etc/shadow

Author : Redhat Magazine editorial team

When you trying add a user, sometimes following error occurs "mismatch in /etc/passwd and /etc/shadow", the error can occurs when there is inconsistencies between the /etc/passswd and /etc/shadow files. The files needed to neither modified or removed. You need to run the following command as root, to find out which account is causing the issue :

pwck

All entries in the /etc/passwd and /etc/shadow are checked to see that the entry has the proper format and valid data in each field. The user is prompted to delete entries that are improperly formatted or which have other uncorrectable errors.

An example of an account that is in /etc/shadow but not in /etc/passwd:

no matching password file entry in /etc/passwd
delete line 'someuser:!!:13758:0:99999:8:::'?

Source : Redhat Magazine