Instead of having a single entry in your users.ldif file, you will list out every user you want to add. Say you want to add multiple entries at once. You will also want to issue the above command from within the same directory that houses the users.ldif file. You will, of course have to modify the above command to match your own LDAP setup. Sudo ldapadd -x -D cn=admin,dc=wallen,dc=local -W -f users.ldif Save that file as users.ldif in your home ( ~/) directory and then issue the command: The above example is a very simple entry which will add the user Jack Wallen (common name) who is listed as a person (objectClass) to the LDAP directory. The file contents will look like:ĭn: cn=Jack Wallen,ou=people,dc=wallen,dc=local To illustrate this technique, let’s create a file to add a single, simple entry to your LDAP directory. The basic usage of the ldapadd command is:īefore we get into the actual command, let’s build a file first. Since the latter method is far more efficient (and can also be implemented to add a single entry), I will demonstrate the addition of an entry using an ldif file. You can add entries one at a time or you can create a text file for which ldapadd will read from.
![ldap query tool linux ldap query tool linux](https://devconnected.com/wp-content/uploads/2020/02/and-operator.png)
The ldapadd command can be used in a couple of ways. I will also assume you have LDAP up and running and you are now ready to begin adding entries. I am also going to be running the commands on the server that contains the LDAP directory (again for the sake of simplicity). Your network, of course, will be different.
![ldap query tool linux ldap query tool linux](https://avinetworks.com/docs/21.1/ldap-authentication/img/Screen-Shot-2016-08-03-at-2.06.29-PM.png)
That base dn will be used for nearly every LDAP command on my network. The network is wallen.local so the base dn of this network will look like “dc=wallen,dc=local”.
![ldap query tool linux ldap query tool linux](https://directory.apache.org/studio/static/images/screen_aci_editor.jpg)
They may be, at first, a challenge to understand, but once you get the basics they are as simple as any other Linux command.įor the sake of simplicity I am going to use my own, small network as an example. In order to successfully manage your LDAP data from the command line you need to be familiar with three commands: ldapadd, ldapmodify, and ldapsearch. The LDAP command line can be a bit frightening at first, but once you get to know it it’s not all that bad. Whether it is a simple search or adding/deleting/modifying an entry - the time is coming, and when it does you better be ready for it. Eventually, however, you may need to manage your LDAP data from the command line. Recently I wrote an article about a GUI tool that can help the new user get LDAP up and running on their server (see my article “ Simplify LDAP with Fedora’s 389 Directory Server“). You can get started managing LDAP from the command line on Linux with three simple commands. Managing an LDAP server can be intimidating, but it’s not as difficult as it seems at first glance.