Right folder permissions after migration to new host


after i migrated the virtual machine where the nextcloud instance is running to a new host system, i cant use it beacause the folder permissions of the data path is incorrect.

There is a kvm, libvirt virtuaisation.
On the host-server i have one folder, its shared to the vm.
What is the correct folder permissions of the user folders ?
I have set the following settings for the home folder.

755 - user: www-data - goup : www-data
But i cant change the permissions of the appdata folder and the files_external.
whats about the index.html , .htaccess and the updater.log ?
i always get the server internal error, but there is no log file.

My system : ubutnu-server 16.04 LTS , Apache2 PHP v 7.0




You can check the webserver log, internal errors should show up there (if not, there could be something wrong about the permissions of the logfile, full disk, …).

You can change the permissions of all files with:

chown -R www-data.www-data /path/to/nextcloud
find /path/to/nextcloud/ -type d -print0 | xargs -0 chmod 0750
find //path/to/nextcloud/ -type f -print0 | xargs -0 chmod 0640


thanks for your reply.
wich path do you mean ?
Is it the data path or the installation path of the instance ?

You can use it for both. Some prefer to use more restrictive settings for the code (so it isn’t writable by the webserver), then the automatic updater won’t work (or you have to undo it just before an update).