Restoring the Stash Administrator's Password

Miscellaneous

On this page

Still need help?

The Atlassian Community is here for you.

Ask the community

Symptoms

No administrator can log into Stash.

Cause

The password of any of the users who have administrative rights within Stash have been forgotten. 

Resolution

About the procedure below

 

We have published a new document that substitutes the procedure below for Stash 2.11+. Please try that first:

Lockout recovery process

 

The following solution applies if any of the Stash administrator usernames are known and are defined in the Internal Directory. If no administrators are defined in the Internal Directory, see Restore Stash's Administrator User.

If an administrator exists in the Internal Directory but their username is unknown:

  1. Connect to the Stash database.
  2. Query the database as follows to identify all user with administrator privileges, select one, and continue with the instructions below:

    SELECT u.name FROM sta_global_permission p, cwd_directory d, cwd_user cu, stash_user u
    WHERE p.user_id = u.id
    AND p.perm_id = 7
    AND d.id = cu.directory_id
    AND d.impl_class = 'com.atlassian.crowd.directory.InternalDirectory'
    AND u.name = cu.user_name
    
    
  3. If no user is found, use the following query to identify all the users that are members of groups with administrator privileges instead, select one, and continue with the instructions below:

    SELECT u.user_name
    FROM sta_global_permission p, cwd_group g, cwd_directory d, cwd_membership m, cwd_user u
    WHERE g.group_name = p.group_name
    AND p.perm_id = 7
    AND d.id = g.directory_id
    AND d.impl_class = 'com.atlassian.crowd.directory.InternalDirectory'
    AND g.id = m.parent_id
    AND u.id = m.child_id
    AND m.membership_type = 'GROUP_USER';

 

Stash does not store passwords in plain text in the database, but uses hashes computed from the original password. You will need to insert a hash, rather than the plain password, over the existing password in the database. Below is the hash for the password admin:

{PKCS5S2}4PCXluhV1YoY3yGgp77MfHjoFoS7GwNxif4gQLpwIfqLs9n/3seRLlECMu2CWGtm

For an External Database

To change the password to admin for a given username:

  1. Shut down Stash.
  2. Connect to your database.
  3. Run the following SQL:

    UPDATE cwd_user SET credential='{PKCS5S2}4PCXluhV1YoY3yGgp77MfHjoFoS7GwNxif4gQLpwIfqLs9n/3seRLlECMu2CWGtm' WHERE user_name='<Stash-admin-Username>';

For the Evaluation Embedded HSQL Database

To change the password to admin for a given username:

  1. Shut down Stash.
  2. Open <stash-home>/data/db.script.
  3. Search for:

    INSERT INTO cwd_user VALUES(
    
  4. Keep searching until you find the appropriate user, then replace their password with the hash value above.
  5. Save the file.
  6. Restart Stash.

 

Note: If after changing the password the CAPTCHA is still there you can try the following query to reset it:

UPDATE cwd_user_attribute SET attribute_value=0, attribute_lower_value=0 WHERE user_id=<Stash-admin-username-id> AND (attribute_name="failedAuthenticationAttemptCount" OR attribute_name="invalidPasswordAttempts")


 

 


Last modified on Feb 23, 2016

Was this helpful?

Yes
No
Provide feedback about this article
Powered by Confluence and Scroll Viewport.