Lost admin account

Support intro

Sorry to hear you’re facing problems :slightly_frowning_face:

help.nextcloud.com is for home/non-enterprise users. If you’re running a business, paid support can be accessed via portal.nextcloud.com where we can ensure your business keeps running smoothly.

In order to help you as quickly as possible, before clicking Create Topic please provide as much of the below as you can. Feel free to use a pastebin service for logs, otherwise either indent short log examples with four spaces:

example

Or for longer, use three backticks above and below the code snippet:

longer
example
here

Some or all of the below information will be requested if it isn’t supplied; for fastest response please provide as much as you can :heart:

Nextcloud version (eg, 12.0.2): 17.0.1.1
Operating system and version (eg, Ubuntu 17.04): Ubuntu 16.4.6 LTS
Apache or nginx version (eg, Apache 2.4.25): Apache 2.4.18
PHP version (eg, 7.1): 7.2.24

The issue you are facing:

I am unable to log in as admin, as I have lost my admin password. I tried using occ user:resetpassword to no avail. I also tried completely deleting the admin user and re-adding it, which also did not work. I tried adding my main user to the admin group, but that hasn’t worked either. It doesn’t seem like anything i try has any effect on anything at all.

Is this the first time you’ve seen this error? (Y/N): y

The output of your Nextcloud log in Admin > Logging:

Unable to log in as admin, therefore cannot paste log.

The output of your config.php file in /path/to/nextcloud (make sure you remove any identifiable information!):

<?php
$CONFIG = array (
  'instanceid' => 'oca2skvyv65v',
  'passwordsalt' => 'xxxxxxxx',
  'secret' => 'asd123',
  'trusted_domains' =>
  array (
    0 => 'mydomain',
  ),
  'datadirectory' => '/var/www/nc/data',
  'dbtype' => 'mysql',
  'version' => '17.0.1.1',
  'overwrite.cli.url' => 'http://ip.addr/nc',
  'dbname' => 'nc',
  'dbhost' => 'localhost',
  'dbport' => '',
  'dbtableprefix' => 'oc_',
  'dbuser' => 'nc',
  'dbpassword' => 'dbpassword',
  'installed' => true,
  'app_install_overwrite' =>
  array (
    0 => 'keeweb',
  ),
  'maintenance' => false,
  'has_rebuilt_cache' => true,
  'theme' => '',
  'loglevel' => 2,
);

The output of your Apache/nginx/system log in /var/log/____:

nothing applicable

Hi @bacafe

Your nextcloud log might be of help. Instead of getting it from the admin page you can also directly access the file:

/var/www/nc/data/nextcloud.log

Apart from that it would be interesting to learn, what exactly you did e.g. when you write “I have tried to reset the password” or “I have tried to re-add the user”. What did you do and what were the error messages?

Cheers

Hey @simonspa

Apart from that it would be interesting to learn, what exactly you did e.g. when you write “I have tried to reset the password”

I was using the sudo -u www-data php /var/www/nc/occ user:resetpassword admin to reset the password. It says that the password was successfully changed, however, it won’t log in. When i try to log in, it says password is incorrect. I know the password is correct, because i am copying and pasting the password from my password manager.

“I have tried to re-add the user”

I tried deleting the user was sudo -u www-data php /var/www/nc/occ user:delete admin then sudo -u www-data php /var/www/nc/occ user:add --display-name="admin" --group="admin" admin. The user:delete command says user successfully deleted, and the user:add command says it was also successful.

Thanks

Also, nothing happens in the log when i do any of those commands.