
Running a plain LDAP search query without any filters is likely to be a waste of time and resource. When running a LDAP search as the administrator account, you may be exposed to user encrypted passwords, so make sure that you run your query privately. In order to perform a LDAP search as this account, you would have to run the following query $ ldapsearch -x -b "dc=devconnected,dc=com" -H ldap://192.168.178.29 -D "cn=admin,dc=devconnected,dc=com" -W

$ ldapsearch -x -b -H -D -WĪs an example, let’s say that your administrator account has the following distinguished name : “ cn=admin,dc=devconnected,dc=com“.

To search LDAP using the admin account, you have to execute the “ldapsearch” query with the “-D” option for the bind DN and the “-W” in order to be prompted for the password. To achieve that, you will need to make a bind request using the administrator account of the LDAP tree. In some cases, you may want to run LDAP queries as the admin account in order to have additionnal information presented to you. If you want to restrict the information presented, we are going to explain LDAP filters in the next chapter. $ ldapsearch -x -b "dc=devconnected,dc=com" -H ldap://192.168.178.29Īs you can see, if you don’t specify any filters, the LDAP client will assume that you want to run a search on all object classes of your directory tree.Īs a consequence, you will be presented with a lot of information. If your server is accepting anonymous authentication, you will be able to perform a LDAP search query without binding to the admin account. $ ldapsearch -x -b -H Īs an example, let’s say that you have an OpenLDAP server installed and running on the 192.168.178.29 host of your network.

If you are not running the search directly on the LDAP server, you will have to specify the host with the “-H” option. The easiest way to search LDAP is to use ldapsearch with the “-x” option for simple authentication and specify the search base with “-b”.
