Restoring the Stash Administrator's Password
症状
No administrator can log into Stash.
原因
The password of any of the users who have administrative rights within Stash have been forgotten.
ソリューション
About the procedure below
We have published a new document that substitutes the procedure below for Stash 2.11+. Please try that first:
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:
- Connect to the Stash database.
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
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:
- Shut down Stash.
- Connect to your database.
次の 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:
- Shut down Stash.
- Open
<stash-home>/data/db.script
. Search for:
INSERT INTO cwd_user VALUES(
- Keep searching until you find the appropriate user, then replace their password with the hash value above.
- ファイルを保存します。
- 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")