How to get Linux users list from LDAP

3

We've just linked one of our Linux host to LDAP and ActiveDirectory. Now I'm trying to check how I get list of users and their details from within the Linux side.

mosh

Posted 2012-01-10T13:32:50.357

Reputation: 235

Answers

4

You can achieve that by either typing in

getent passwd |less

or performing a LDAP search, such as

ldapsearch -x -LLL uid=*

(assuming that the bind DN and credentials are set in the ldap.conf file or you have read access to AD in other ways).

Valentin

Posted 2012-01-10T13:32:50.357

Reputation: 826

3

If you want to check if your Linux sees the POSIX entries from a LDAP server, use

getent passwd

The output should display entries both from local /etc/passwd and LDAP server. If you are wondering how to get to the point, when there's something to check, this may prove to be a good starting point.

badbishop

Posted 2012-01-10T13:32:50.357

Reputation: 180

2

Use the ldapsearch command line tool to query the directory server for information. For more information, see "LDAP: Mastering ldapsearch".

Terry Gardner

Posted 2012-01-10T13:32:50.357

Reputation: 827

1

Depending on how your Linux host is set up, wbinfo -u may work for you.

From the wbinfo's manpage:

wbinfo - Query information from winbind daemon

...

-u|--domain-users

       This option will list all users available in the Windows NT domain
       for which the winbindd(8) daemon is operating in. Users in all
       trusted domains will also be listed. Note that this operation does
       not assign user ids to any users that have not already been seen by
       winbindd(8) .

Example:

antonio@debian:~$ wbinfo -u
administrator
antonio
guest
support_388945a0
krbtgt
antonio@debian:~$

Antonio Vinicius Menezes Medei

Posted 2012-01-10T13:32:50.357

Reputation: 146

1

Linux usually uses PAM for its authentication needs. It's an open architecture, so you can use the pam_ldap module to use LDAP on Linux.

MSalters

Posted 2012-01-10T13:32:50.357

Reputation: 7 587