[Solved] User admin account is disabled. How to abilitate again?

My user admin was locked after trying to login with wrong credentials, but also the account is disabled, so I cannot login and I tried to reset the password but I’m not getting any e-mail.

Is there any way to abilitate the user from the database?

try this:
sudo -u www-data php occ user:resetpassword admin_username

1 Like

Thanks for your suggestion. Something important I forgot to mention, is that I do not have SSH access. I have nextcloud on my webhosting server with cPanel.

Is any other suggestion there?

  • If you’re able to execute SQL command on your database you can try the following command (on your own risk!):
    UPDATE oc_users SET password = '<admin_new_pass>' WHERE uid = '<admin_user_name>';
  • Ask your web hoster support for help.

Thank you very much for your suggestions.

I resolve it other way. I want to share it just in case it helps someone else:

At oc_group_user table within phpMyAdmin, I copy another user and add it to the admin group. Thay way I access with that user as an administrator and activate back the original admin account.


In case it helps, you can access SSH in Cpanel as detailed in this guide.

I’ve found an easier solution. You need an access to database (phpMyAdmin, Adminer, or else). You have to just execute this query:

UPDATE oc_preferences SET configvalue = 'true' WHERE appid = 'core' AND configkey = 'enabled' AND userid = 'user_id'

Replace user_id with user’s login id.

Or in the console (locally or by SSH) from NextCloud directory:

sudo -u www-data php occ user:enable user_id

I just had the same problem and by checking differences in database, I’ve found this row in oc_preferences. Enjoy!

1 Like