Admin User without Administration Pannel

Hello,

We have a gogs running on OpenShift with PostgreSQL, yesterday we detected that our administrator user has stopped having vision of Administration Pannel maybe someone has unchecked the “This user is administrator” check or similar.

I’m trying to access BBDD to ALTER table or modify table to add permission to this user but if i login with gogs user on postgresql i get the following output:

sh-4.2$ psql -U gogs -W
Password for user gogs:
psql (9.5.9)
Type "help" for help.

gogs=> \dt
                 List of relations
 Schema |           Name           | Type  | Owner
--------+--------------------------+-------+-------
 public | access                   | table | gogs
 public | access_token             | table | gogs
 public | action                   | table | gogs
 public | attachment               | table | gogs
 public | collaboration            | table | gogs
 public | comment                  | table | gogs
 public | deploy_key               | table | gogs
 public | email_address            | table | gogs
 public | follow                   | table | gogs
 public | hook_task                | table | gogs
 public | issue                    | table | gogs
 public | issue_label              | table | gogs
 public | issue_user               | table | gogs
 public | label                    | table | gogs
 public | login_source             | table | gogs
 public | milestone                | table | gogs
 public | mirror                   | table | gogs
 public | notice                   | table | gogs
 public | org_user                 | table | gogs
 public | protect_branch           | table | gogs
 public | protect_branch_whitelist | table | gogs
 public | public_key               | table | gogs
 public | pull_request             | table | gogs
 public | release                  | table | gogs
 public | repository               | table | gogs
 public | star                     | table | gogs
 public | team                     | table | gogs
 public | team_repo                | table | gogs
 public | team_user                | table | gogs
 public | two_factor               | table | gogs
 public | two_factor_recovery_code | table | gogs
 public | upload                   | table | gogs
 public | user                     | table | gogs
 public | version                  | table | gogs
 public | watch                    | table | gogs
 public | webhook                  | table | gogs
(36 rows)

gogs=> SELECT * FROM user;
 current_user
--------------
 gogs
(1 row)

Please, could you help me where can i recover this function of Administrator or where i can modify something to recover this.

We have tried “Recover admin password” but without result.

If you need more information or something, please tell me.

Thank you very much for the support.

Hi,

  1. Looks like your Gogs instance only have 1 user “gogs”? (that you expect it to be the admin)
  2. If you still remember the password, just change the column is_admin to be true in user table.

Hi,

1- When we installed Gogs, we created a administrator user with a name “admin” but when we execute querys on PostgreSQL pod to “user” table, we only see “gogs” user (Maybe this “gogs” user can be the administrator of the DDBB).
We have about 50 users on gogs that they are not admins but executing the same query “SELECT * FROM user;” we can only see the same “gogs” user.
Is there another table or database that stores all of users?

2.Of course, we remember the password. We can try it but the problem is that we only see “gogs” user.

Thank you very much for the support.

Hello,

First of, thank you so much for the support.

I could create a new user with the following command:

./gogs admin create-user --name test --password test --admin --email [email protected]

After we execute this command, we could login with this user and enter to “Administration Panel” and modify my “admin” user and check the option “This account has administrator permission”

Thank you for all!!

It seems you connected to the wrong database… if you have 50 users, the table should have 50 rows.