How to view LDAP maps from a client machine ?
In this article, we will see how to see LDAP maps from a linux client machine.
The quick and easy way to do this is using ypcat command.
1. Get ldap map from server.
saket@ngelinux001 ~]$ ypcat automount | head ngestora01-s1:/gcc/csc_vol1/csc_vol1/cclocal/local.$OSNA ngestora04-p4:/vols/csc_vol2 ngestora04-p4:/vols/cs_vol1 galaxy:/export/& auto.grid_common_pkgs -ro,hard,intr auto.grid_madajaju auto.grid_sfi_drm -rw,hard,intr auto.grid_common -ro,hard,intr auto.grid_icft -rw,hard,intr auto.grid_sfv -rw,hard,intr
Similarly we can get details from other maps as well.
2. To see available maps on our system, we can check out ldap.conf file.
[saket@ngelinux001 ~]$ cat /etc/ldap.conf ###################################################################### # @(#)ldap.conf generated by ldapprofile $Revision: 1.9 $ # # Created at: Mon Mar 21 10:02:03 2022 # Valid until: Mon Mar 21 11:02:03 2022 # Profile DN: cn=INDIA-vm01,ou=profile,o=ngel.com # Profile base: o=ngel.com # Profile name: INDIA-vm01 # Profile description: INDIA OpenDJ VM01 Profile # Profile host: 10.202.56.7 # Profile bind: cn=proxyagent,ou=profile,o=ngel.com # Profile bindpass: proxy # Sudo Profile : default-images ###################################################################### BINDDN cn=proxyagent,ou=profile,o=ngel.com BINDPW proxy HOST 10.254.10.205 10.254.10.206 10.254.10.10 10.254.10.11 BASE o=ngel.COM SCOPE sub TIMELIMIT 300 BIND_TIMELIMIT 10 REFERRALS TRUE NSS_BASE_PASSWD ou=people,o=ngel.com?one NSS_BASE_SHADOW ou=people,o=ngel.com?one NSS_BASE_NETWORKS ou=networks,ou=corp,ou=services,o=ngel.com?one NSS_BASE_RPC ou=rpc,ou=corp,ou=services,o=ngel.com?one NSS_BASE_PROTOCOLS ou=protocols,ou=corp,ou=services,o=ngel.com?sub NSS_BASE_NETMASKS ou=netmasks,ou=corp,ou=services,o=ngel.com?one NSS_BASE_HOSTS ou=hosts,ou=corp,ou=services,o=ngel.com?one NSS_BASE_SERVICES ou=services,ou=corp,ou=services,o=ngel.com?one NSS_BASE_GROUP ou=group,ou=corp,ou=services,o=ngel.com?one NSS_BASE_ALIASES ou=aliases,ou=corp,ou=services,o=ngel.com?one NSS_BASE_NETGROUP ou=netgroup,ou=default,ou=INDIA,ou=services,o=ngel.com?one NSS_BASE_AUTOMOUNT ou=automount,ou=default,ou=INDIA,ou=services,o=ngel.com?sub SUDOERS_BASE cn=default-images,ou=sudoprofile,o=ngel.com [saket@ngelinux001 ~]$
3. Lets use ypmatch command to match the text in specified map.
[saket@ngelinux001 saket]$ ypmatch saket passwd saket:{CRYPT}1ePffAkTZ3wvs:281678:1001:Saket Jain:/home/saket:/bin/csh [saket@ngelinux001 saket]$ ypmatch adminteam group adminteam:*:1333:mohitk,jaimatn,jiyomishra,aguptam,akimli
The other command is to use the ldapsearch and ldapmatch query with your credentials if you have your ID in LDAP created.