NextcloudPi 18.0.2 crashes - no more login - one user lost - add user possible?

Raspberry Pi 4 - NextcloudPi 18.0.2 - it is a Debian
Nextcloud version: 18.0.2.2
Operating system and version: Linux cloud 4.19.97-v7l+ #1294 SMP Thu Jan 30 13:21:14 GMT 2020 armv7l GNU/Linux

Apache or nginx version: Apache
PHP version: php 7.3 - php-fpm

The issue I am facing:
my nextcloud is running on RaspPi4 an ssd: one partion is the OS, second partition in mounted to /var/www, third part. /var/lib/mysql, forth part. is backup.
Yesterday the cloud hang up and I had to power off - the RaspPi was working nearby the windows in the sun and maybe it was going hot.
After that, I can’t login the user “ncp” (admin) and user “user” (user): “wrong user or password”.

I got this problem a few month before (no sun, but hangup too and no login anymore) and I did a reinstall - I am lazy. Now I stored data in the cloud - now I am afraid.

I connected via ssh: all the data are still present in the file system.
doing “sudo -u www-data php /var/www/nextcloud/occ user:list” shows only user “ncp”, no user “user”.
doing “sudo -u www-data php /var/www/nextcloud/occ user:resetpassword ncp” works: I set a new password and “ncp” can login again. Did nothing else than logging in, until now.

The questions are:
is it possible to do:

  1. “sudo -u www-data php /var/www/nextcloud/occ user:add user”
  2. “sudo -u www-data php /var/www/nextcloud/occ files:scan user”

Does user:add delete the directory “/var/www/nextcloud/data/user”?
Can I access the data again? Has there any rights to be corrected - in the database perhaps?

I backed-up /var/www and /var/lib/mysql via rsync on a separat partition, but I never did a complete restore - only some files. Is it possible (rsync /var/www + /var/lib/mysql in maintenace mode)?

I can not understand, why a poweroff can perform a crash like this. I did no adminwork, only watching files; maybe an automatic uploud via smartphone. Where is the user “user” gone? Who changes why both passwords? What else has gone?

It happened two times and I hope you can give me some answers or show me where I can find Information about this questions.

Thank you very much.

No real idea because of the error. If you backup all files all is fine.

I think you can move /var/www/nextcloud/data/user to a position on the same partition like /var/www/tmp/user and then you create a new user. After create the new user you can move the data /var/www/tmp/user back to /var/www/nextcloud/data/user and “occ fils:scan” . Perhaps you only move “/user/files” back.
Read all subfolders for the user. On my system: files, files_external, files_trashbin, files_versions, uploads After re-add the user perhaps only “files” is sensible.

Is ncp an admin user also in nextcloud? Then you can create the user also in the nextcloud-gui.

Thank you for reply.

… and it is working again.
yes, ncp is admin.
No problem any more, but a big question mark.
The Raspberry crashed, because of overheating, I think.
Maybe, the mount of /var/lib/mysql does not work while crashing and initiated the problem. I do not know much about databases.
When I ask “occ user:list” the pi was restarted the first time and every partition was mounted. I checked it, because I suspected a hard drive crash. There was no user “user” shown, and the password “ncp” has to be set new.
Now, it look like it is stabil, … and robust.

Fine. Thank you.