Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

Attempting to add a (non-existant) user to my CentOS system is returning useradd: user example exists. I can successfully manually add the user to /etc/passwd and /etc/shadow, but that workaround is A Bad Thing. The user exists in LDAP, but PAM isn't using LDAP for authentication. Adding other users works fine. I'm stumped.

ETA:

[root ~]# userdel example
userdel: error deleting password entry
userdel: error deleting shadow password entry
[root ~]# useradd example
useradd: user example exists
[root ~]# su example
bash-3.2$ whoami
example
bash-3.2$ groups example
example : Users
bash-3.2$ cd
bash: cd: /home/example: No such file or directory
bash-3.2$ 
share|improve this question
1  
Have a look at this: serverfault.com/questions/62743/… –  Khaled Jan 16 '12 at 13:46
1  
What did you get if you try su example? –  Khaled Jan 16 '12 at 13:48
    
@Khaled It drops me into a standard bash shell. pwd shows location as /root. whoami shows as the user, groups example shows that they're a member of the Users group –  Tom Jan 16 '12 at 13:50
    
useradd aliased? –  Tim Jan 16 '12 at 14:32
    
[root@ ~]# which useradd /usr/sbin/useradd, not aliased. –  Tom Jan 16 '12 at 14:33

1 Answer 1

up vote 7 down vote accepted

If you include LDAP in the /etc/nsswitch.conf (for example passwd: files ldap or passwd:compat passwd_compat:ldap, etc.) it is enough for getent passwd and thus for useradd to see LDAP entries.

Both utilities have nothing to do with PAM, and happily recognize LDAP entries even if PAM knows nothing about LDAP.

By the way, if you have nscd running, remember to restart it after you change nsswitch.conf.

share|improve this answer
    
Goodness, my understanding of linux auth is clearly lacking. I didn't know that was a thing. That was it, thanks! –  Tom Jan 16 '12 at 15:03

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.