Nextcloud permissions error ruining my experience

I’m stuck, and no resource I can find online has the solution I need.

I installed Nextcloud through Snap on Ubuntu 16.04, for convenience. It worked perfectly, but my SSD doesn’t have the space I need, and I had to redirect Nextcloud’s data directory to /media/raid750/nextcloud/data. /media/raid750 is where my 750GB RAID1 array is mounted. Yes, Nextcloud has access to removable devices in the /media/ directory. The RAID array is in the Ext4 file system; the array was initially formatted in NTFS, but I reformatted to Ext4 because I thought that was the reason behind my following problem (it apparently wasn’t).

When I try to connect to Nextcloud from another computer, I get the error:

Your data directory is readable by other users
Please change the permissions to 0770 so that the directory cannot be listed by other users.

I searched far and wide for a remedy to this issue. One of the suggestions was to enter the command ‘sudo chmod 0770 /media/raid750/nextcloud’. I did this, and nothing changed: I still got the same error, even after restarting Nextcloud.

Another suggestion was to enter ‘sudo chown www-data:www-data /media/raid750/nextcloud’. Instead of solving the problem, that command resulted in the following errors:

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. See https://docs.nextcloud.com/server/12/go.php?to=admin-dir_permissions

This feels like a step farther away from the problem. Setting chown back to root for my directory takes me back to the first problem, changing the permissions to 0770. I really don’t know what to do. Do I need to modify something in /etc/fstab, even though my array is Ext4? Please help. Thank you!

Did you try this?

Also, if that doesn’t work, the following should help:

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

In both examples, remember to change any references to nextcloud to the directory that you want to change the permissions on.

1 Like

A post was split to a new topic: How can I change permissions under snap

Thank you !

This worked beautifully. :smiley: