Dirk's Tech Findings

Samba: Rename a user in Samba AD

Publication date: 2020-03-18

Issue: I needed a solution to rename a user in Samba Active Directory

Renaming a user in Samba Active Directory from Linux command line appeared to be unexpectedly complicated.

Solution: Modify the user on low level

Run

samba-tool user edit olduser

and change the attributes "sAMAccountName" and "userPrincipalName" to the new name, save and exit.

Afterwards rename the object in database:

ldbrename -H /var/lib/samba/private/sam.ldb 'CN=olduser,CN=Users,DC=ad,DC=mydomain,DC=de' 'CN=newuser,CN=Users,DC=ad,DC=mydomain,DC=de'

In my case

WARNING: Module [samba_dsdb] not found - do you need to set LDB_MODULES_PATH?
Unable to load modules for /var/lib/samba/private/sam.ldb: (null)

appeared. This could be fixed by running

export LDB_MODULES_PATH=/usr/lib/samba/ldb

first.

Back to topic list...