Various documents say that you can access and modify OpenLdap's basic configurations using ldapsearch and ldapmodify, however they do not dot the Is or cross the Ts of how you do it.
Some distributions automatically define a special user that you can login as, typically this is cn=admin,cn=config. Ubuntu does not do this, instead it grants full acess to the system root user.
First, you must be root - real root. sudo -s is not good enough. You have to do a su - or sudo su -.
Second, you must use -Y EXTERNAL -H ldapi:///. Using -x or -H ldap://localhost does not work. Because you are real root you do not need -D: root automatically has access to everything.
Now you can do slapcat or ldapsearch to examine the configuration, e.g.
ldapsearch -Y EXTERNAL -H ldapi:/// -b cn=config
You can also modify the configuration. For instance you can add an extra database module by having the ldif file:
dn: cn=module,cn=config changetype: add objectClass: olcModuleList cn: module olcModulePath: /usr/lib/ldap olcModuleLoad: back_passwdand loading it into the running configuration with
ldapmodify -Y EXTERNAL -H ldapi:/// -f /tmp/addModule.ldif