[Solved] Wrong admin password

Hi

Since this morning I can’t log-in as admin to my nextcloud dashboard, password is no accepted.
I didn’t made any changes, no update or anything.

Reset password doesn’t work either.

I don’t know what to do, I only have FTP and phpMyAdmin access.

Is this the first time you’ve seen this error? Y

Ehh that’s probably not good, check the error log of NextCloud in your FTP and if there nothing there… Then likely your DB or installation became a vector of an attack of some sort to cause the password to leak and thus allowing the hacker to get in and change it. Then as well of changing the email.

Possibly even directly somehow.

If you have any doubts of such I would do a clean install and start over. Preferably over SSH for the admin account so no one can intersect the installation’s page for setting up the admin account.

I found multiple occurrence of this error in error log :

PHP Fatal error: Uncaught Error: Access to undeclared static property: OC\Files\Filesystem::$normalizedPathCache in /home/.../public_html/cloud/lib/private/Files/Filesystem.php:798

https://docs.nextcloud.com/server/15/admin_manual/configuration_user/reset_admin_password.html

Have you tried this?

2 Likes

I don’t know how to use the occ command on this server. :flushed:
It’s a cloud hosting on Planethoster.
I have a terminal acces, but the following command doesn’t work :
sudo -u www-data php /home/…/public_html/cloud/occ user:resetpassword adminv
bash: sudo: command not found

The occ command has to be executed inside the nextcloud installation directory.

If you are logging in with the user www-data just call the following command:
php /home/…/public_html/cloud/occ user:resetpassword adminv

If not and you have the permissions to switch users just try:
su -s /bin/bash -c ‘php /home/…/public_html/cloud/occ user:resetpassword adminv’ www-data

This is the same command as in your last comment with sudo but works on systems where sudo is not installed. It just switches the user to www-data.

3 Likes

It works, thanks a lot !

Hello,
I have the same issue but for all 50+ users and 6 admins. This happened instantly and I cannot get access to the nextcloud. Using terminal in Win SCP I logged in to the server and typed as you suggested but it says: “OCC not understood”, tried also different types of this command but still result is the same. Could you please suggest what else can be done? Thank you very much in advance!

Have you eventually deleted or modified the following parameter:

'secret' => '',

Secret used by Nextcloud for various purposes, e.g. to encrypt data. If you lose this string there will be data corruption.

Does the occ command script exists in the Nextcloud document root directory and how are the access rights set?

Thank you for your reply!
No I didn’t delete anything even didn’t login into it, since all was working fine. Where can I check for this parameter to make sure it present?

Yes the file is present in home directory i.e. /public_html/nextcloud/occ
Shall I put the file contents here?

It doesn’t help if you didn’t have a backup of the config.php file available for a comparison.

It doesn’t help to paste the content of the script, more important are the file ownership and the access rights. What does the following command show:

ls -al /public_html/nextcloud/occ

How do you exactly try to execute the command?

I logged in to the hosting of the site via WinSCP and typed the command into the terminal window
Here is the result:
/public_html/nextcloud$ ls -al /public_html/nextcloud/occ
500 LS not understood

It seems that you’re not using a ssh access but a ftp access. This would be an explanation for this error message. See, e.g.

https://winscp.net/forum/viewtopic.php?t=25066

Yes, you right. I tried to login with ssh via putty and MobaXterm, but didn’t succeed. Also as instructed in the given link for WinSCP "To open current session also in PuTTY, go to Commands > Open in PuTTY . " opens putty an in second closes the window.

I think without shell access you won’t be able to fix the issue. You should contact your hoster and ask him for help getting this issue fixed.

I contacted technical support and they told me it is a shared web hosting package so that they cannot grant customers access to SSH. I asked to execute the command on my behalf. Based on what they told is that the command lists the folders/files within that folder. Therefore I have access via ftp and can provide the list as shown. And looking onto the dates of files and folders changed they were untouched since installation, except “data” folder which as I understand correctly contains user profiles and log file which is updated constantly after each attempt to login by any user.

I haven’t expected that the base files have been changed, but eventually the config.php file which you should find in the given config directory. Therefore it would be more important that they reset your admin password using the mentioned occ than showing the directory content. With a simple ftp access you won’t be able to do any debugging or resetting of a password.
Before resetting any password, you should check the content of the Nextcloud log file to get an idea why access isn’t possible anymore. The log file, by default, resides in the data directory of Nextcloud.

Config.php havent been changed since installation:
config
Same as occ have not been touched:
occ
I just attempted to login and here is the recent log record:
{“reqId”:“XhTR1TT9SEa2K26JZKzFCgAAAAA”,“level”:2,“time”:“2020-01-07T18:45:42+00:00”,“remoteAddr”:“193.61.145.177”,“user”:"–",“app”:“core”,“method”:“POST”,“url”:"/nextcloud/index.php/login?user=uu_admin",“message”:“Login failed: ‘uu_admin’ (Remote IP: ‘193.61.145.177’)”,“userAgent”:“Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.88 Safari/537.36”,“version”:“15.0.5.3”}

So, I would recommend to ask the support to reset the admin password. But I couldn’t help you any further with it, because I have the intension that you never thought about creating a backup of your system beforehand etc.

I have back up. Should I then ask support to use the command as shown above?

Would it be possible to download the whole folder of nextcloud to local PC run password recovery and then upload back to the server?