Using ldapvi to quickly modify LDAP directories

ldapvi is a command-line LDAP directory editor provided through the popular Vi(m) editor. It is provided as a package under Debian:

aptitude update
aptitude install ldapvi

To edit the contents of a local directory server just run

ldapvi --discover --bind-dialog=always

This will then prompt for the distinguished name you wish to connect with and the password. For example

Filter or DN: cn=admin,dc=example,dc=co,dc=uk
Password: *******

You can then edit existing entries, and create new entries.

Editing entries can be done by simply changing the values of the fields in the editor. Extra fields can be added to an entry, or fields deleted from the entry.

Note: Do not change the number at the beginning of the entry as ldapvi uses this to track the changes you make.

To add a new entry, create the entry as required, but put the word add or add: instead of the entry number.

When done, exit Vim, saving changes, and ldapvi will prompt (listing your changes) before updating the LDAP directory.

Article last modified on January 26, 2014 at 3:33 pm.

Leave a Reply

Your email address will not be published. Required fields are marked *