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

how to reset or create new non-Crowd user after migrating Stash

guy moore July 10, 2015

Stash 3.7.1

I migrated/moved our production Stash to another machine for test purposes.

After importing the database, untarring the home directory, doing some config changes,

I can't log in. 

I think I shut off the Crowd authentication method by doing:

update cwd_directory set is_active='F' where id=229377;

(and I no longer get the message:

"The remote authentication server is not available. Please try again later."

)

 

I've viewed all the atlassian docs about resetting admin password, adding a new dbuser1/admin user

but when I log in, I now get:

    "You do not have permission to access Stash."

 

The most recent PostgreSQL sql that I have run, following the documents, is the following:

INSERT INTO cwd_user (id,user_name,lower_user_name,is_active,created_date,updated_date,last_name,lower_last_name,display_name,lower_display_name,email_address,lower_email_address,directory_id,credential) VALUES (999999999,'dbuser1','dbuser1','T','2014-01-08 12:12:12','2014-01-08 12:12:12','dbuser1','dbuser1','dbuser1','dbuser1','dbuser1@dbuser1.com','dbuser1@dbuser1.com',32769,'{PKCS5S2}4PCXluhV1YoY3yGgp77MfHjoFoS7GwNxif4gQLpwIfqLs9n/3seRLlECMu2CWGtm');
# INSERT INTO stash_user (id, name, slug) VALUES (999999999,'dbuser1','dbuser1');
INSERT INTO stash_user (id) VALUES (999999999);
INSERT INTO sta_global_permission (id, perm_id,user_id) VALUES (999999999,7,999999999);

The atlassian-stash.log log file doesn't print anything out during the failed login.

The audit/atlassian-stash-audit.log does, but nothing about why it is failing.

Help.

1 answer

1 vote
Balázs Szakmáry
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.
July 10, 2015

I think you are looking for this.

guy moore July 11, 2015

Hi Balazs, I saw that page, but didn't want to try that at this point.

 

Note to self:[SOLVED]

I have corrections for this link, https://confluence.atlassian.com/display/STASHKB/Restore+Stash's+Administrator+User that I was following.

The table of stash_user only has one column in it, not 3, so the database being used by my Stash 3.7.1 is set up differently than the one in that link.

If one wants to add a new user, dbuser3, with password admin, these are the specific inserts I had to do to get it to work:

INSERT INTO cwd_user (id,user_name,lower_user_name,is_active,created_date,updated_date,last_name,lower_last_name,display_name,lower_display_name,email_address,lower_email_address,directory_id,credential) VALUES (666666666,'dbuser3','dbuser3','T','2014-01-08 12:12:12','2014-01-08 12:12:12','dbuser3','dbuser3','dbuser3','dbuser3','dbuser3@dbuser3.com','dbuser3@dbuser3.com',32769,'{PKCS5S2}4PCXluhV1YoY3yGgp77MfHjoFoS7GwNxif4gQLpwIfqLs9n/3seRLlECMu2CWGtm');
INSERT INTO stash_user (id) VALUES (88888888);
INSERT INTO sta_normal_user (user_id, name, slug) VALUES (88888888, 'dbuser3', 'dbuser3');
INSERT INTO sta_global_permission (id, perm_id,user_id) VALUES (777777777,7,88888888);

Restartng the Stash server may be necessary to flush the cache.

The values of 88888888 can be any id value that isn't used already, but they all have to be the same amongst all 3 tables.

The id values of 777777777 and 666666666 can be any value that isn't already used, and can be different values.(I don't think they are used in joins between eachother.)

The user_name of cwd_user table and name/slug value of sta_normal_user table, all need to match.

 

Balázs Szakmáry
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.
July 11, 2015

Have you seen that the page you linked to starts with "For Stash versions 2.11+ see Lockout recovery process."? These instructions you mean to correct are for a much older version.

guy moore July 11, 2015

Good point.

( i had read that same sentence,incorrectly, as meaning that these instructions were "for 2.11+".

But that other page suggests putting the server in "recovery mode" fixing something, and then restarting server back out of recovery mode. Maybe that's the proper way to fix the problem. I wanted to find a similar method of manipulating the database, and possibly even adding an additional user.

Next time I build out a Stash test server, i will try that recovery step and see how it goes.

Thank you for your persistence.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events