LDAP: getent passwd don’t show the recent user addition

centos7ldapopenldap

I don't know why getent don't show my recently LDAP user addition.

  1. ldif file:

    dn: uid=user1,ou=People,dc=example,dc=com
    uid: user1
    cn: user1
    objectClass: account
    objectClass: posixAccount
    objectClass: top
    objectClass: shadowAccount
    userPassword: {SSHA}8t8W2kC48FN0QvwQk8JMRP/OQPI75sjP
    shadowLastChange: 16444
    shadowMin: 0
    shadowMax: 99999
    shadowWarning: 7
    loginShell: /bin/bash
    uidNumber: 1005
    gidNumber: 1005
    homeDirectory: /var/www/html

  2. ldapadd:

    ldapadd -x -W -D 'cn=Manager,dc=example,dc=com' -h 127.0.0.1 -f user1.ldif

  3. ldapsearch work and shows user1

  4. getent passwd don't show my new user.

Anyone knows what's the problem? I'm sure is not much complicated but I don't find the solution.

Best Answer

Following the guide lines of @sven (thank you so much!) I've solved my question and I post the answer for it helps somebody.

First of all, I've checked id getent passwd was showing LDAP users or only local users. In my case, it shows only local users.

Second install if you don't have it, authconfig: yum -y install authconfig

Write the following command to enable it:

authconfig --passalgo=sha256 --enablelocauthorize \
--enablemkhomedir --enableldap --enableldapauth \
--ldapserver=ldap://127.0.0.1 --ldapbasedn=dc=example,dc=com \
--enableshadow --update

Console write in my case:

getsebool:  SELinux is disabled

Then configure start on boot like this:

chkconfig nslcd on

Start service:

service nslcd start or systemctl start nslcd.service

Try getent:

getent passwd user1

Console write the LDAP user:

user1:*:1005:1005:user1:/var/www/html:/bin/bash

I hope that it is well.

Related Topic