Problem trying to recover admin account in locally installed Confluence instance
Asked by william_hart:

Hi,

I have a Confluence server which was set up originally to authenticate via Jira. However, it seems that all the admin account password was lost and the connection to Jira also lost. I've been given the task of trying to recover this mess. I've followed the instructions in this page:

<https://confluence.atlassian.com/conf59/restore-passwords-to-recover-admin-user-rights-792499440.html#RestorePasswordsToRecoverAdminUserRights-nolocal>

This has enabled me to assign the 'admin' account to the confluence-administrators and confluence-users groups, but when I log in I don't have any access to any spaces, nor can I manage any part of Confluence at all (there's no top 'gear' menu). I've checked in the postgresql database and the admin user is definitely part of the correct administrators and users groups. I can log in, but I just don't have visibility of any space or any part of the management tools.

I already had a confluence-users and confluence-administrators groups with ids which didn't match 888888 and 999999, so I simply amended the sql commands to account for this. I checked the admin account's privileges by running the following:

    select u.id, u.user_name, u.active from cwd_user ujoin cwd_membership m on u.id=m.child_user_id join cwd_group g on m.parent_id=g.id join cwd_directory d on d.id=g.directory_idwhere g.group_name = 'confluence-administrators' and d.directory_name='Confluence Internal Directory';

This confirmed that 'admin' was an administrator. Yet when I log in, I have minimal permissions and can't see any spaces or have any access to the administrative tools.

If anyone has any ideas how I can amend the system settings via either postgresql or the unerlying server config files so the admin user can actually administrate, that would be hugely helpful. I'm running Confluence 9 on a Linux system locally, with the postgresql instance also running on the same box. Thanks.


Answers:
author: Diego
body: Hello [@william_hart](/t5/user/viewprofilepage/user-id/3934967) !

As I understand, after following the procedure presented here:
> * ++***[\[Confluence Server\] Restore Passwords To Recover Admin User Rights](https://confluence.atlassian.com/conf59/restore-passwords-to-recover-admin-user-rights-792499440.html#RestorePasswordsToRecoverAdminUserRights-nolocal)***++

The administrator user is still unable to correctly login to the instance.

I would start by checking the currents status of the internal directory in your database. The value for the active column on the cwd_directory must be set to T.

I have seen this error a few times in the past and usually it had to do with the placement of the internal directory.

The internal directory must be the first in the priority list for the fix to be applicable.

I still have some questions about your instance:
> 1. *Are you applying this fix directly into your production instance?*
> 2. *Since this question was posted a few days ago, are you still facing the same issue?*
> 3. *What happens if you follow the fix without taking in consideration the already existing groups in your instance and use the queries as displayed there?*

Let us hear from you!

comments: author: william_hart
body: Hello [@Diego](/t5/user/viewprofilepage/user-id/1188952) ,

Thanks for your reply. I will certainly check the 'active' column in the cwd_directory for starters. In answer to your questions:

1. This is an 'old' production environment (we are moving to the cloud version, but need the data from the old).

2. Yes, I'm still facing the same issue, but haven't tried looking at your suggested fix yet.

3. I'm not sure about this one. The issue originally had to do with the fact that Jira was tied to the Confluence instance in authentication terms. Jira still works, but Confluence doesn't. My main concern was to simply get administrative access to Confuence so that anything required (re-assigning admin privs to existing accounts, etc) could be carried out somehow.

Thanks once more for your help. I'll have a look at what you suggest and let you know if it fixes the issue.

Kind regards

Bill Hart


author: william_hart
body: I checked the status of the Confluence cwd_directory entries and they are both set to 'T' for active:

```
confluence=> select * from cwd_directory;
id | directory_name | lower_directory_name | created_date | updated_date | active | descri
ption | impl_class | lower_impl_class | directory_type
--------+-------------------------------+-------------------------------+---------------------+-------------------------+--------+--------------------
-------------------+----------------------------------------------------+----------------------------------------------------+----------------
131074 | Confluence Internal Directory | confluence internal directory | 2015-08-06 09:30:18 | 2015-08-06 09:30:18 | T | Confluence default
internal directory | com.atlassian.crowd.directory.InternalDirectory | com.atlassian.crowd.directory.internaldirectory | INTERNAL
131073 | Remote JIRA Directory | remote jira directory | 2015-08-06 09:30:18 | 2020-06-09 07:24:02.655 | T |
| com.atlassian.crowd.directory.RemoteCrowdDirectory | com.atlassian.crowd.directory.remotecrowddirectory | CROWD
(2 rows)
```

I'm not sure if both the internal and 'crowd' types should be set to active, but that's how it would have been set prior to my investigation (when it worked).

The admin user is definitely a member of the correct groups (confluence-user and confluence-administrators):

```
confluence=> select * from cwd_membership where parent_id=196609;
id | parent_id | child_group_id | child_user_id
--------+-----------+----------------+---------------
196610 | 196609 | | 262145
(1 row)

confluence=> select * from cwd_membership where id=196623;
id | parent_id | child_group_id | child_user_id
--------+-----------+----------------+---------------
196623 | 196610 | | 262145
(1 row)
```

```
? 196610 | confluence-users | confluence-users | T | F | 2015-08-06 09:30:18 | 2015-08-06 09:30:18 | | GR
OUP | 131074
196609 | confluence-administrators | confluence-administrators | T | F | 2015-08-06 09:30:18 | 2015-08-06 09:30:18 | | GR
```

The ID 262145 is for 'admin'.

Not sure where I've gone wrong, but if you have any further thoughts or suggestions, I'd be grateful for any ideas.

Kind regards,

Bill Hart


Tags: confluence-server

server