I have installed Nextcloud via snap on a Linux Mint 20.2 Cinnamon system.
Since I wanted Nextcloud to use a dedicated HD for its data, I have mounted an HD to /mnt/nextcloud
and made a /data
folder into it as explained here https://github.com/nextcloud-snap/nextcloud-snap/wiki/Change-data-directory-to-use-another-disk-partition
The installation seems to work at first, I can go to localhost
and set up username and password. After that though, I get the following error:
Your data directory is invalid
Ensure there is a file called ".ocdata" in the root of the data directory.
Your data directory is not writable
Permissions can usually be fixed by giving the webserver write access to the root directory. See https://docs.nextcloud.com/server/21/go.php?to=admin-dir_permissions.
The file .ocdata
is actually in the directory, so it must be a permission problem. But if I change the folder permission from 0770
to 777
I get:
Your data directory is readable by other users
Please change the permissions to 0770 so that the directory cannot be listed by other users.
If I change it back to
0770
, I get the first error.
The link https://docs.nextcloud.com/server/21/go.php?to=admin-dir_permissions doesn't point to any solution either.
I have also tried sudo chown -R www-data:www-data /mnt/nextcloud/data
, but I still get the first error.
Any idea on how to deal with this?
Best Answer
The snap runs as confined root. Try
sudo chown -R root:root /mnt/nextcloud/data
.