Folders/Files aren´t appearing in Nextcloud web/client

Dear Community,

my problem is this: on the weekend all data was deleted, but not all. Whether this was a user error I do not know, nobody could tell me so far. An excerpt from the log file reads:
…“app”:“PHP”,“method”:“DELETE”,“url”:“xxx”,“message”:{“Exception”:“Error”,“Message”:"fread(): read of 8192 bytes failed with errno=21 Is a directory at…

At that time I had Nextcloud v20.0.8.1 (now v22.2.3) with PHP 7.4.

Anyway, I have restored all files from the mentioned period from the Recycle Bin. So far so good…
After checking the data, I noticed that not all of them could be recovered.

There were still folders in the trash, but they were completely empty. I connected to nextcloud via FTP and saw that all the data was created correctly there and that all data was present. I can now download the data via FTP, but I can’t open it because it’s encrypted. Uploading again does not work either, the data will not be decrypted.

An “occ files:scan --all” shows no solution. File is not displayed in the client." mysql -u root -p -e “UPDATE oc_filecache SET mtime=storage_mtime” nextcloud" doesn’t work either, because I don’t have sudo rights because my cloud is installed on a service provider. Accordingly, I cannot deactivate the encryption and download the files via FTP and upload them again via the client.

Do you have a solution?

Do you have the same behavior in different clients?
E.g. web browser, Windows, Linux, MacOS, Android, iOS and WebDAV.

If you use a client perhaps you can uninstall and install the client again.

In the most cases the server-side-encryption is not useful.
Perhaps someone can post a possiblity to decrypt the files.

One possiblity is perhaps to build locally a copy of the whole nextcloud.

Thank you for your prompt response.

Unfortunately, the same behavior can be seen in every client, whether WebDAV, Windows, iOS or Android. Nowhere are the missing folders displayed, not even in the Recycle Bin. However, via FTP I see the folders and their contents.

I know how to disable the “server-side-encryption”, but not without “sudo”:

cd /var/www/html/nextcloud/
sudo -u www-data php occ encryption:decrypt-all
sudo -u www-data php occ maintenance:mode --on
sudo -u www-data php occ encryption:disable
sudo -u www-data php occ maintenance:mode --off

Can you login (ssh) to your webspace and then execute commands? If this is possible you can use your user and all commands without sudo -u www-data

Your examples:

cd /var/www/html/nextcloud/
php occ encryption:decrypt-all
php occ maintenance:mode --on
php occ encryption:disable
php occ maintenance:mode --off

I built a workaround so that I got access to ftp-nextcloud with “sudo”. But you’re right, I can do all suggested orders without “sudo”.

Now I have trouble with the first order

php occ encryption:decrypt-all

This message is coming:

You can only decrypt the files of all users if the
recovery key is enabled by the admin and activated by the users.

Please enter the recovery key password:
Could not decrypt private key, maybe you entered the wrong password?
Module “Default encryption module” does not support the functionality to decrypt all >files again or the initialization of the module failed!
aborted.
Server side encryption remains enabled

Password is correct… What can I do?

SOLUTION:
https://help.nextcloud.com/t/disable-server-side-encryption-lost-recovery-key-password/102471
This suggestion works well, very recommened

Zu meiner Lösung:
Es gibt ein Skript hier im Forum:

decrypt-all-files.php

Dieses Skript hilft, um verschlüsselte Dateien zu entschlüsseln, falls sie in Nextcloud (WebDAV, Windows, iOS, etc.) nicht mehr gelesen werden können.

Vorgehen:

  • Passe das Skript nach den im php stehenden Vorgaben an
  • Kopiere das Skript via SSH auf die Nextcloud in einen Ordner, egal wo (muss auf jeden Fall in der Nextcloud innerhalb des Users sein)
  • Erstelle einen Zielordner, in den alle entschlüsselten Dateien rein sollen
  • Starte das php wie folgt:
    php decrypt-all-files.php Zielordner […]
  • Sichere Zielordner auf lokaler Festplatte
  • php occ maintenance:mode --on
  • Lösche verschlüsselte Daten auf dem Server
  • Ersetze entschlüsselte Daten auf dem Server
  • php occ maintenance:mode --off
  • php occ files:scan

So hat es bei mir funktioniert.