After months of threats, we're finally migrating servers from NIS+ to LDAP. I'm happy using niscat, nisgrep etc and now it seems I have to use ldapsearch which is far from being a simple CLI!
Are there any easy (easier?) ways to interrogate the LDAP directory?
Jerry
Well you could use getent.
getent passwd <username> is like ypmatch <username> passwd
getent hosts <hostname> is like ypmatch <hostname> hosts
I already use getent for passwd, group etc. but it doesn't work for other tables (scsu, scsudo etc)
Since my original post, I've come up with my own quick and dirty solution...
The following has been added to my profile
ldap() {
if [ -z $2 ] ; then
ldapsearch -h <host> -b ou=$1,dc=euruxdev,dc=dyn,dc=nsroot,dc=net objectclass='*'
else
ldapsearch -h <host> -b ou=$1,dc=euruxdev,dc=dyn,dc=nsroot,dc=net $2
fi
So if I type
ldap <table>
I get the whole lot, but I can add a filter with, for example
ldap <table> cn=<entry>
Jerry