Update LDAP account command line

Update LDAP account command line

Update LDAP account command line

In this example we are going to use the classic example of “Jane Doe” got married to “Joe Buck” so needs her account, and everything in the university updated from “Jane Doe” to “Jane Buck.” Thanks Jane….. Here’s the process:

login to your LDAP server, and su to root

Root shell prompt on the OpenLDAP server ldapdemo after su to root

cd /tmp where we can manipulate the LDAP database

Running ldapsearch -x > ldapdb in /tmp to dump the LDAP directory to a file

from here we need to do a dump of the LDAP database

Running ldapsearch -x > ldapdb to save the LDAP entries before editing Jane's account

let’s edit ldapdb

Running vi ldapdb to open the LDAP dump file

from here we need to find Jane Doe’s account

Jane Doe's LDAP entry in the dump with sn Doe and cn Jane Doe

now let’s set the line numbers with a CTRL+C and then a :set nu

Typing :set nu in vi to turn on line numbers

it should look like so:

Typing :107 w! JaneBuck in vi to write Jane Doe's dn line to a file

we are going to now write lines 107 to a file with ctrl+c and then the following:

vi command :107 w! JaneBuck saving line 107 to the JaneBuck file

done, now let’s edit the file:

Running vi JaneBuck to edit the LDIF change for Jane's account

in this part of the example, we are changing 2 things, the SN, and the cn:

LDIF with changetype modify replacing sn with Buck and cn with Jane Doe and Jane Buck

run the following to commit the change to the database:

ldapmodify -x -D cn=admin,dc=mydomain,dc=local -W -f JaneBuck modifying Jane Doe's entry

now Jane Doe/Jane Buck are both aliases of this account. Let’s dump LDAP

Updated LDAP entry for Jane with sn Buck and both cn Jane Doe and cn Jane Buck

as you can see at the bottom, the SN (last name) is Buck, and the account will respond as both Jane Doe or Jane Buck.

That’s it!

Hosted Linux Servers at www.zwiegnet.com/go

Related guides: Add User to LDAP command line | Change home directory of LDAP user command line

Leave a Reply

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