Iām having a really hard time getting the permissions straight. Iāve had nextcloud running, but had issues saving or deleting items. Iāve messed around with it more and currently canāt access the GUI.
Hereās the error I receive-
Your data directory is invalid Ensure there is a file called ā.ocdataā in the root of the data directory. Cannot create ādataā directory This can usually be fixed by giving the webserver write access to the root directory.
nextcloud is installed on Ubuntu server. The data directory is an NFS share folder on a Synology NAS mounted at /mnt/storage. As root on the server I can write and delete files within /mnt/storage. Iāve given www-data rwx permissions on that folder. There is an .ocdata file at /mnt/storage.
This should create an empty file as user www-data. For permissions, itās not only the folder itself, the permissions of the parent folder and the mount options can be important as well.
Thanks. Iām pretty new to Linux and knew there was a way to do that, but couldnāt remember how. When I first tried it said I didnāt have permission. I messed around with chmod and chown some more and now Iām able to add a file and have access to the GUI again.
Still am not able to delete a folder from the GUI though. As info, in DSM I have No mapping set for squash.
I think I finally have this all working.
For anyone else using similar setup with data folder on Synology NAS using NFS-
NSFv4 support is not checked
On the shared folder, no NAS local user has access
NFS permissions squash is set to no mapping
On the server, www-data was given ownership of the NFS mount.
chown -R www-data:www-data /mnt/storage
chmod -R 0770 /mnt/storage #should result in- drwxrwxā 7 www-data www-data 4096 Sep 28 12:00 storage #test ownership
sudo -u www-data touch /mnt/storage/test2.txt #correct ownership of config.php at /var/www/nextcloud/config
chown root:www-data config.php #should result in- -rw-rw---- 1 root www-data 697 Sep 15 01:40 config.php #correct ownership permissions to delete
sudo php occ files:scan --all #older posts said to use sudo -u www-data php occ files:scan --all but that gave an error āConsole has to be executed with the user that owns the file config/config.phpā root owns config.php so must be run as root. #also had to update cron.php to run as root
Because people often ask about fstab, mine is- 10.10.0.73:/volume1/nextcloud /mnt/storage nfs defaults uid=www-data,gid=www-data,umask=770 0 0