Tips and tricks: When I am trying to add a user, the following error occurs: mismatch in /etc/passwd and /etc/shadow. What does this mean?
by the editorial team
This can occur when there is inconsistencies between the /etc/passwd and /etc/shadow files. The offending account needs to either be modified or removed. To find out which account is causing the issue run the following command as root:
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:::'?







February 22nd, 2008 at 7:23 am
Hi,
this is very usefull command. Thx.
February 28th, 2008 at 11:09 am
Hi,
There is another command that do the same, but for the groups - “grpck” !
Regards
Nikolay Kabaivanov
Fashion.bg Ltd.
February 28th, 2008 at 1:50 pm
Anyone for “pwconv”. It fixes the problem but does not tell you what it does. You can also use “grpconv” for group. They handle NIS(+) entries properly (does nothing).
February 28th, 2008 at 3:42 pm
I tried pwconv on a file that was in /etc/passwd format except the passwords were in plain text. It copied the plain text passwords to shadow and replaced the ones in passwd with an ‘x’. I thought it was supposed to encrypt the passwords. Anyway I finally got the job done using the newusers prog. I didn’t use the same encryption scheme as passwd, but I can still login to the newly established accounts. Can anyone explain what’s going on?
February 28th, 2008 at 9:59 pm
dear sir
i read linux for u magazine
in this magazine i read about autologin
i try to login but not complete
can you help me how i can auto login
thanks & regard
Dinesh kumar
March 4th, 2008 at 6:53 am
ith, pwconv did it by design. It is used to convert old pre-shadow /etc/password to the new shadow-compliant format. That is, no passwords in /etc/passwd, encrypted or otherwise. real passwords were removed from /etc/passwd and replaced with an x, indicating real ones are in /etc/shadow now. Excerpts from pwconv’s man page “pwconv creates shadow from passwd and an optionally existing shadow.”
March 4th, 2008 at 7:03 am
I’d recommend a more cautions process on a real server,
1) make a copy of the malformed password and shadow file
cp /etc/passwd /tmp/passwd.bad; cp /etc/shadow /tmp/shadow.bad
2) run ‘pwck’ against copies instead of the originals.
pwck /tmp/passwd.bad /tmp/shadow.bad
3) compare to see what changes were made and whether they make sense. manually adjust as necessary
diff /etc/passwd /tmp/passwd.bad
4) schedule a time to put the new set in place, to minimize user impact.