How to set correct permissions for OwnCloud user?

I’m setting my RPi3 to serve OwnCloud and I’ve got external drive for the data. My issue is that when selecting location where my data folder is into the set-up page it gives me: error can't create or write into the data directory

so I added UUID=F307-C810 /media/pi/F307-C810 auto nofail,uid=33,gid=33,umask=0027,dmask=0$ into /etc/fstab file which sets ownership of the drive on every boot. 33 is id of the OwnCloud user and F307-C810 being the drive name.

I also ran sudo chmod -R 775 /media/pi/F307-C810 which should give sufficient permissions for my use case.

Yet I get the error. What else I can try ?

What filesystem is your drive?
The user and group id is only set on non POSIX filesystems like NTFS or FAT.
If you’re using a native filesystem like EXT4, you’ll just mount as root, and create a user folder inside the mount point.

See below:
/dev/sda1 vfat 699G 128K 699G 1% /media/pi/F307-C810

It’s formatted to FAT so it should work out of the box right ?


from what i have read in the past in the post below ownCloud doesn’t support non-linux filesystems like NTFS or FAT:

See also the following discussion:

1 Like

Also FAT is a horrible filesystem, you can’t store files bigger than 2 or 4 GBs, if I remember correctly.

1 Like

OK, so I formatted the drive to ext4, configured permissions in fstab and using chown and chmod and created data directory as well. Yet getting the same error ?

Check on the CLI that you can create files with sudo -u www-data touch /path/to/data/folder/testfile.
If not something with the permissions is still wrong.

Otherwise, are you perhaps running something like SELinux that is blocking some filesystem access?

1 Like

I can’t run it. Gives permission denied. Which is super weird 'coz I’m running it as root using the www-data user whom root gave ownership over that drive and everything that’s in it.

Gotta say I’m very happy that Linux permission system is this robust. So robust root can hardly do anything haha.

I can run anything as a root but if I use www-data through root it throws an error.
Sorry, I don’t know what SELinux is. Would have to do extra research about it.