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.
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.
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?
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.