JIRA created duplicate user and has moved all users to the new user



Some administrator in jira made the following mistake, amplified by a bug in JIRA I believe (or 2).


Assumption: username of admin if peter, it's an account in a delegated user directory (AD).


1) Peter logs in to JIRA, goes to user management

2) Peter creates an INTERNAL user with username (also) peter. ( by mistake, but jira doesn't warn him or block this action).

3) Peter gets logged out because this new internal peter overwrites his own account

4) Another admin logs in and sees the new *internal* peter account.


5) Upon viewing this user, JIRA tells us there are duplicate accounts (no kidding, but better late than never).


6) Admin changes the username of the new peter account to 'peter_new'.


7) Now the old peter account from the delegated directory shows up in the list of users again. All good?!?!?


8) No! JIRA has connected every single action and issue from the 'peter' account to the 'peter_new' account. So peter_new is suddenly the reporter of thousands of issues from years ago, also peter_new is the assignee of open issues. All comments seem to be made by peter_new. 



I did create a support ticket, but response is slow.

Is there any easy way I can move back all issues, comments, etc to the original 'peter' user? Some SQL probably?

2 answers

0 votes

You can connect multiple user directories to Jira Server.  However when the same username exists in multiple directories, only the user account in the top ordered directory in JIRA is the one that is able to login to JIRA.   That is the first fact you need to be aware of.

Second, when you rename a user account in Jira, or in a LDAP directory that is syncing to Jira, Jira is trying to be helpful and in turn will track these user account renames in order to make sure your account still has all the previous history, etc.

You might be able to fix this via SQL, but the easier solution is to go back to the peter_new account and just rename it again back to peter.   Then delete that account in the internal directory.   Provided that your LDAP directory still has the old 'peter' account still there, then after that internal account is deleted from the Jira internal directory, the next time peter tries to login, it will use the credentials form the other user directory (LDAP).

Right now your cwd_user directory has likely two different entries for peter.  But each account there has a different directory_id to show that it originates from a different user directory.  But I wouldn't typically recommend hacking away at SQL to fix this, at least not without knowing a lot more of the details here.

I would recommend that you create a backup of you database before you try any changes like this though just to be safe.

Thanks, but JIRA won't let me rename the peter_new to peter. It tells me there already is a user with name peter.


Why isn't JIRA performing this check when new users are created?


BTW The support team sent me some SQL queries, which didn't not work but I managed to solve it myself. All that was needed was a litlle fiddling with the app_user table (so it seems).

Suggest an answer

Log in or Sign up to answer
Community showcase
Published Nov 27, 2018 in Portfolio for Jira

Introducing a new planning experience in Portfolio for Jira (Server/DC)

In the past, Portfolio for Jira required a high degree of detail–foresight that was unrealistic for many businesses to   have–in   order to produce a reliable long-term roadmap. We're tur...

2,304 views 12 19
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you