Update with tool and data permission folder

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:


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


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, 20.0.5): 25.0.10
Operating system and version (eg, Ubuntu 20.04): RaspberryPiOS
Apache or nginx version (eg, Apache 2.4.25): Apache 2.4.56
PHP version (eg, 7.4): 8.0.30

The issue you are facing:

Whenever I update my Nextcloud server through the update tool, the update always hangs while copying old files. At this point I have to redo the update manually.
I could be wrong, but could the problem be due to permissions of the DATA folder?
If my server is on a RaspberryPi, I have the data in a folder created specifically on a NAS connected to a LAN. With the update tool, I create the backup in a subfolder on the NAS, which is why I think there is a permissions problem, even if everything else works correctly and from the Nextcloud interface I can reach, create and modify everything my data. Below I report the permissions of the Nextcloud data folder and its main subfolders.
I’m tempted to give permissions for the entire folder to www-data, but I don’t want it to break everything.

drwxr-x--- 10    1024 users    4096 29 ago  2022  NextCloud
drwxr-x--- 10 1024 users      4096 29 ago  2022 .
drwxrwxrwx 15 root root       4096 10 set 17.55 ..
drwxr-xr-x  5 1024 users      4096 19 feb  2022 admin
drwxr-xr-x 13 1024 users      4096 25 ago  2022 appdata_ocvm0qngwepo
-rw-r-----  1 1024 users     12488 25 mar 10.16 audit.log
drwxr-xr-x  3 1024 users      4096 19 feb  2022 files_encryption
drwxr-xr-x  2 1024 users      4096 10 set 16.25 files_external
-rw-r--r--  1 1024 users       542 10 set 16.25 .htaccess
-rw-r--r--  1 1024 users         0 10 set 16.25 index.html
drwxr-xr-x  8 1024 users      4096 10 lug  2022 user2
drwxr-xr-x  8 1024 users      4096 27 ago 22.38 user1
-rw-r-----  1 1024 users  78642166 10 set 20.00 nextcloud.log
-rw-r-----  1 1024 users 104881302 29 ago  2022 nextcloud.log.1
-rw-r--r--  1 1024 users         0 10 set 16.25 .ocdata
drwxr-xr-x  6 1024 users      4096  5 apr  2022 user3
-rw-r--r--  1 1024 users    267821 10 set 16.02 updater.log
drwxr-xr-x  4 1024 users      4096 10 set 16.02 updater-ocvm0qngwepo

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

Steps to replicate it:

  1. Update with Update tool

Normally the update does not touch the data-folder. Perhaps just one folder where it puts a backup of current code. But it needs full access to the code folder, if the process is run as www-data and the permission are set like you have shown here (with users as user), www-data can’t move and replace files.

OK thank you. So if I wanted to change the permissions of the entire nextcloud folder (therefore including all subfolders) and give them to www-data, nextcloud shouldn’t give me any problems accessing that data, right?
If so, how should I assign permissions? Are the ones indicated for the installation folder OK during manual updating, like the ones below?

chown -R www-data:www-data nextcloud
find nextcloud/ -type d -exec chmod 750 {} \;
find nextcloud/ -type f -exec chmod 640 {} \;

Yes, they look good.