5

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$ 
kubanczyk
  • 13,812
  • 5
  • 41
  • 55
Tom
  • 185
  • 1
  • 2
  • 8

2 Answers2

10

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.

kubanczyk
  • 13,812
  • 5
  • 41
  • 55
  • 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
0

I was able to delete user and adding him again after stopping the sssd service (I had no idea it was on the server)

service sssd stop
deluser -f MyUser
DimiDak
  • 128
  • 3