Publication date: 2020-03-18
Renaming a user in Samba Active Directory from Linux command line appeared to be unexpectedly complicated.
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.