Thursday, May 06, 2010
Here are a couple easy methods to get information from ldap for a particular user. Friend and I were talking about it yesterday because we had a typo in someone's login directory string (missing a character). He showed me a fancy one-liner but all I needed was a username, login directory, and its corresponding UID.
# ldaplist -l password username
# getent passwd username
# logins -x | grep username
The getent command is also handy to retrieve host and group information. It consults what databases are listed in the /etc/nsswitch.conf file.
# getent hosts hostname
# getent group 100