Bulk modify usernames in JIRA

Mihai Schwarz
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
October 20, 2016

Do you know by any chance if there is another way to modify multiple users? For example I have multiple users that are firstname.lastname@email.com and I want to delete @email.com from their user. 

I tried doing this from the DB but I ended up changing the usernames how I wanted but the users appear  corrupt.

Thanks!

1 answer

1 accepted

0 votes
Answer accepted
Jonas Andersson
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
October 20, 2016

This needs to be properly tested before done on the production but i have done something very similar a few years back and this approach worked superwell.

  1. Create a local admin account in the internal database if you don't already have one.
  2. Shut down JIRA
  3. dump database
  4. do:

    cat your.jira.db.sql | sed 's/@email.com//g' > your.new.jira.db.sql
  5. Drop the database, recreate an empty database, import the new dump.
  6. Restart Jira and attempt to login with what would be your new username

You might have to login with JIRA using a built in admin account if this fails, in that case you might also have to adjust the JIRA user directory to reflect that you no longer use the email, but another object for usernames on AD or whatever you might use.

Once authentication is done, i warmly recommend you to rebuild all indexes. You will also have to do the same for all other systems that ride on Jira's authentication. An example would be if Confluence uses a JIRA user server for authentication, Confluence database would need the same treatment.

Other things to think of:

If you have users with other email addresses you can piggyback these with more sed statements, but beware that a user can only exist once, so if you have a tony@email1.com and a tony@email2.com you will end up with a conflict.

I warmly recommend you to test, test, test, test and test again on a virtual server that is a close clone of your system before you actually go ahead and do this on a production system. Make sure you back up both databases and filesystems so you can reverse fast. Make it an art, than kick it into gear.

Good luck.

Mihai Schwarz
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
October 23, 2016

Thanks Jonas, I will try to do this!

Suggest an answer

Log in or Sign up to answer