Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I'm running RHEL 5. When using the GUI System>Administration>Users and Groups, I get the error:

The user database cannot be read. This problem is most likely caused by a mismatch between /etc/passwd and /etc/shadow or /etc/group and /etc/gshadow. The program will exit now.

Some research showed that I need to use vipw and vigr respectively to find an inconsistency between these two sets, which I did - to make it easy I copied each from [vipw | vigr] to an excel file and did =exact(%1, %2). There are no inconsistencies.

What gives?

// Edits //

sudo pwck -r yeilds several users without home directories:

user adm: directory /var/adm does not exist
user news: directory /etc/news does not exist
user uucp: directory /var/spool/uucp does not exist
user gopher: directory /var/gopher does not exist
user ftp: directory /var/ftp does not exist
user pcap: directory /var/arpwatch does not exist
user sabayon: directory /home/sabayon does not exist
user oprofile: directory /home/oprofile does not exist
user avahi-autoipd: directory /var/lib/avahi-autoipd does not exist

I assume this is normal for service accounts.

However, sudo grpck -r yields some interesting output (sanitized):

no matching group file entry in /etc/gshadow
add group 'g0' in /etc/gshadow ?No
'u1' is a member of the 'g1' group in /etc/group but not in /etc/gshadow
'u2' is a member of the 'g1' group in /etc/group but not in /etc/gshadow
'u3' is a member of the 'g1' group in /etc/group but not in /etc/gshadow
no matching group file entry in /etc/group
delete line 'users:::'? No
no matching group file entry in /etc/group
delete line 'u4:!::'? No
no matching group file entry in /etc/group
delete line 'u1:!::'? No
no matching group file entry in /etc/group
delete line 'u2:!::'? No
no matching group file entry in /etc/group
delete line 'u3:!::'? No
no matching group file entry in /etc/group
delete line 'u5:!::'? No
no matching group file entry in /etc/group
delete line 'u6:!::'? No
no matching group file entry in /etc/group
delete line 'u7:!::'? No
grpck: no changes

So, clearly we found some problems. It looks to me that automated repair would be destructive in some cases.

share|improve this question
    
It looks like you found your problem. –  Dennis Williamson Aug 9 '10 at 18:12
add comment

1 Answer

up vote 1 down vote accepted

Why would you use Excel?

cut -d: -f1 /etc/passwd | sort > p.out
sudo cut -d: -f1 /etc/shadow | sort > s.out
diff p.out s.out
rm p.out s.out

Or in Bash:

diff <(cut -d: -f1 /etc/passwd | sort) <(sudo cut -d: -f1 /etc/shadow | sort)

and you can do the same kind of thing for /etc/group and /etc/gshadow.

You need to run GUI System>Administration>Users and Groups with elevated permissions. Is it asking you for a password?

share|improve this answer
    
+1 for <(..cmd...) syntax –  Rich Homolka Aug 6 '10 at 15:48
    
Because it's what I know - Your way is definitely slick, but I needed a way to quickly and systematically find differences or prove that there weren't any. For me, Excel was that way. I almost facepalmed when I read your elevated permissions bit. I opened a console, switched to root via su, and then ran /usr/bin/system-config-users. Same error as before. –  Tony Aug 6 '10 at 16:59
1  
@Tony: run sudo pwck -r and sudo grpck -r to show you any errors in these files. What do they say (summarize the result or add it to your original question). –  Dennis Williamson Aug 6 '10 at 17:20
    
I answered yes to all of the delete requests from grpck, and now the GUI works. Hopefully users don't call :) –  Tony Aug 9 '10 at 18:10
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.