Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Need to reset admin password on bitbucket server

jitendramohan June 11, 2018

Hi,

I installed BitBucket, JIRA and Confluence on a Linux server. I chose "admin" as the user name and the same complex password for all three. For a while I could login everywhere. 

Now, however, I can only login on JIRA. Cannot login to BitBucket nor to Confluence. When I click on "forgot password", I get the following error:

"Sorry, you can't retrieve your password as no email service has been configured for Confluence. Please contact your administrators for assistance."

Sending an outgoing mail on JIRA works, but I am not sure about BitBucket/Confluence and I have no way of checking.

These are pretty new version and for the most part, there is no/little actual data in them.

Any thoughts? 

3 answers

1 accepted

3 votes
Answer accepted
Christian Glockner
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
June 12, 2018

Hi Yogesh,

If you're completely unable to log into Bitbucket Server, you can use the lockout recovery process (see https://confluence.atlassian.com/bitbucketserver/lockout-recovery-process-776640158.html) to re-gain access, which then allows you to reset the password and configure SMTP.

Cheers,

Christian

Premier Support Engineer

Atlassian

Yogesh Mude
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.
June 12, 2018

HI @jitendramohan

Please have a look at the above lockout recovery process link provide by @Christian Glockner

Hope it help.

jitendramohan June 12, 2018

This worked!! I wish this answer was easier to find ... 

Thanks you very much.

Yogesh Mude
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.
June 12, 2018

Happy to hear, finally this works...

Metin Savignano
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.
December 16, 2021

This worked for me as well!

However, I'd like to amend a stumbling block I had to overcome:

First, I tried to run <Bitbucket installation directory>\bin\start-bitbucket.sh using sudo -u bitbucket but then Bitbucket failed to start.

So I tried again as root (just using sudo) wich worked.

But after having repaired my user access and re-starting Bitbucket the standard way, it failed with some obscure problems not being able to initiate classes.

Assuming that running from root may have changed access rights of some files, I tried

sudo chown -R /var/bitbucket

which in fact fixed the problem.

1 vote
Yogesh Mude
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.
June 11, 2018

HI @jitendramohan

Welcome to the community!

Here is the document related to retrieving the admin password or you can reset the admin password but you should know the username for that.

In this documentation, you can find the DB queries using that you can do rest the admin password.

jitendramohan June 11, 2018

Hi, I did try the suggestion but it did not work. Below is what I get after the change. As you can see, the password for the bitbucket admin is now set as described in the article. However, at the login prompt on the web, I cannot get in. I did not get a chance to setup SMTP therefore I cannot use it to reset password.

 

atlbitbucket=> select u.id, u.user_name, d.directory_name from cwd_user u inner join cwd_directory d on u.directory_id = d.id order by directory_name, user_name;

id | user_name | directory_name
--------+-----------+------------------------------
131073 | admin | Bitbucket Internal Directory
131074 | admin | Jira User Directory
(2 rows)

 

atlbitbucket=> select id, user_name, credential from cwd_user;
id | user_name | credential
--------+-----------+------------------------------------------------------------------------------------------
131073 | admin | uQieO/1CGMUIXXftw3ynrsaYLShI+GTcPS4LdUGWbIusFvHPfUzD7CZvms6yMMvA8I7FViHVEqr6Mj4pCLKAFQ==
131074 | admin | nopass
(2 rows)

Yogesh Mude
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.
June 11, 2018

Hi @jitendramohan

As you can see the admin user belongs to Bitbucket Internal Directory so here you can run the below query and set the password for this admin user once done you can able to log with admin username.

update cwd_user set credential='uQieO/1CGMUIXXftw3ynrsaYLShI+GTcPS4LdUGWbIusFvHPfUzD7CZvms6yMMvA8I7FViHVEqr6Mj4pCLKAFQ==' where user_name='XXXX';

The password for this admin user is a sphere, After successful login with the username you can reset the password for your admin user 

jitendramohan June 11, 2018

Yes, this is what I did. That is why in the second command, you can see that the user "admin" has the same password as you recommend. However, I still cannot login using password 'sphere'. 

Another thing I tried was to remove the "additional application" from under JIRA user server. Didn't help.

Ideas?

jitendramohan June 11, 2018

I also restart the server between login attempts.

Yogesh Mude
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.
June 11, 2018

It should work man..we did many more times.

 

If you see here same admin user is available in both the directory ie Bitbucket Internal directory and Jira user directory hence might be it is confusion for the application to authenticate.

so please just reset the password for another user which belongs to Bitbucket Internal directory and the try to log in.

jitendramohan June 12, 2018

I changed admin to admin_bitbucket. No luck. There are no other users in bitbucket directory (only admin or now admin_bitbucket). Only 3 users exist in JIRA directory.

atlbitbucket=> select id, user_name, credential from cwd_user;
id | user_name | credential
--------+-----------------+------------------------------------------------------------------------------------------
131074 | admin | nopass
131073 | admin_bitbucket | uQieO/1CGMUIXXftw3ynrsaYLShI+GTcPS4LdUGWbIusFvHPfUzD7CZvms6yMMvA8I7FViHVEqr6Mj4pCLKAFQ==
(2 rows)

Yogesh Mude
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.
June 12, 2018

ahh..sorry man.....i tried my best to solve this issue but no luck.:(

jitendramohan June 12, 2018

Can I create a new admin user from scratch within the database?

Yogesh Mude
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.
June 12, 2018

You have changed the username from admin to admin_bitbucket but you should not do this. I said the check is there any other user is available in Bitbucket Internal directory then try to rest the password for that user and then log in.

Can I create a new admin user from scratch within the database?

Actually, don't know, please raise a support ticket to Atlassian they will help you. 

jitendramohan June 12, 2018

Thank you. I changed it back to admin.

I think the problem happened as I directed bitbucket to use Jira directory. However, I did not grant all the required permissions as suggested here:

https://confluence.atlassian.com/bitbucketserver/connecting-bitbucket-server-to-jira-for-user-management-776640400.html

Now, once I logged out of BitBucket, it won't let me get back in.

Arrgh.

0 votes
jitendramohan June 11, 2018

Hi, I did try the suggestion but it did not work. Below is what I get after the change. As you can see, the password for the bitbucket admin is now set as described in the article. However, at the login prompt on the web, I cannot get in. I did not get a chance to setup SMTP therefore I cannot use it to reset password.

 

atlbitbucket=> select u.id, u.user_name, d.directory_name from cwd_user u inner join cwd_directory d on u.directory_id = d.id order by directory_name, user_name;

id | user_name | directory_name
--------+-----------+------------------------------
131073 | admin | Bitbucket Internal Directory
131074 | admin | Jira User Directory
(2 rows)

 

atlbitbucket=> select id, user_name, credential from cwd_user;
id | user_name | credential
--------+-----------+------------------------------------------------------------------------------------------
131073 | admin | uQieO/1CGMUIXXftw3ynrsaYLShI+GTcPS4LdUGWbIusFvHPfUzD7CZvms6yMMvA8I7FViHVEqr6Mj4pCLKAFQ==
131074 | admin | nopass
(2 rows)

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events