Skip to content

Rename user

Cintia Del Rio edited this page Jan 29, 2025 · 2 revisions

There's no easy way to rename a user from crowd or jira. The steps described below worked and history was preserved for talk and JIRA.

We have to hack it straight to LDAP. Make sure to copy the output of these commands to the relevant JIRA ticket. It's recommended to do a backup before (check LDAP docs for details).

The user will still be kept as-is in Formage/OpenMRS ID, but we are sunsetting it.

Step 0: Register user access

Take printscreens of recent activity for JIRA, wiki and Talk for the user. Also all LDAP groups.

Step 1: modify LDAP

$ ssh ldap.openmrs.org
$ sudo -i
$ vi modify-user-<current username>.ldif
dn: uid=<current username>,ou=users,dc=openmrs,dc=org
changetype: modrdn
newrdn: uid=<new username>
deleteoldrdn: 1

$ docker cp modify-user-<current username>.ldif ldap_ldap_1:/root
$ docker exec -it ldap_ldap_1 bash

# list current data
$ USER="<current username>"
$ ldapsearch -LLL -D "cn=admin,dc=openmrs,dc=org" -W -b "uid=${USER},ou=users,dc=openmrs,dc=org"
# creds in LP 

$ ldapmodify -D "cn=admin,dc=openmrs,dc=org" -W -f /root/modify-user-<current username>.ldif
# creds in LP 

# list new data
$ USER="<new username>"
$ ldapsearch -LLL -D "cn=admin,dc=openmrs,dc=org" -W -b "uid=${USER},ou=users,dc=openmrs,dc=org" 
# creds in LP 

Step 2: Verify access

Login to talk, ID, JIRA and Wiki with the new username. Check recent activity for talk, JIRA and wiki. In talk, disconnect all other active logins.

Step 3: Recover

Recover the old password hash in formage.

Clone this wiki locally