# "id: no such user" when getent passwd lists the user



## fengshaun (Jul 14, 2019)

I have setup an ldap server and client (same machine for now). I am now able to have ldap users listed in `getent passwd` and `getent group`, but commands like `id` and `sudo` don't recognize these users. Furthermore, `ls` lists the uids of the users as opposed to the usernames when permissions refer to ldap users. My configuration is as follows:


```
# /etc/nsswitch.conf
group: files ldap
passwd: files ldap
shadow: files ldap
hosts: files dns
netgroup: compat
networks: files
shells: files ldap
protocols: files
rpc: files

# /usr/local/etc/ldap.conf and /usr/local/etc/nss_ldap.conf
host box1.domain.com
base dc=domain,dc=com
uri ldap://box1.domain.com
timelimit 5
bind_timelimit 5
pam_login_attribute uid

# /usr/local/etc/openldap/ldap.conf
BASE    dc=domain,dc=com
URI     ldap://box1.domain.com

# relevant parts of /usr/local/etc/openldap/slapd.conf
database    mdb
maxsize     1073741824
suffix      "dc=domain,dc=com"
rootdn      "cn=root,dc=domain,dc=com"
index   objectClass eq
index   cn,uid,memberUid,uniqueMember,gidNumber pres,eq
```

I have run `truss id myuser` and I see that it reads the following files, contents of which are above:


```
/etc/nsswitch.conf
/usr/local/etc/nss_ldap.conf
/usr/local/etc/openldap/ldap.conf
```

I can also see through `truss` that it calls `getpeername` on the ip of box1.domain.com and connects to port 389 properly.

At this point, I'm out of ideas about where the issue might be between a successful `getent passwd` and `getent group` and failing `id` and `sudo`. Any help regarding troubleshooting is appreciated.


----------

