[Nextcloud] Shared folder permissions

Hey,

I have an internal drive mounted in /media/mydrive.
I can add it in Nextcloud in a new Shared folder, but Nextcloud tell me that I can r/w on it:

You don't have permission to upload or create files here

What should I do in order to allow every apps to R/W on it ?

Thanks a lot !

I’ve just noticed that, from Nextcloud, I can R/W in previously created folders inside my disk, but not at the root of the disk.
Like:

  • /media/mydrive/folder1: Read + write
  • /media/mydrive: You don't have permission to upload or create files here

How can I properly activate R/W on the root of the drive ?

Hello,
You have to deal with the /etc/fstab mount options to allow users in R/W on the mount point
I don’t remember exactly the syntax of this option, but you would be able to find answers on the web

1 Like

I managed to make it worked, here is what I did:

  • Change group ownership of the mount point to group users with chgrp users /mount/point
  • Change the permission of this folder: chmod -R 774 /mount/point

Now Nextcloud and other apps can r/w in it.
Hope it was the right way to do it.

Actually I made a mistake.
With chmod -R 774 it does not work.
It needs chmod -R 777 so Nextcloud can r/w in it. But is it safe ?

I don’t know how to tell which group/user should be assign to this folder so it is safe and accessible by all apps ???

You can do as you’ve done, but the prefered method is to define the owner and the group in the fstab mount point options (in particular the uid and gid).
Here is the syntax:

/dev/mapper/db-db  /var/lib/mysql ext3  relatime,rw,exec,uid=frank,gid=www-group        0       2
1 Like

Thanks for your help.

If I understand correctly, I have to edit the /etc/fstab file, and add this line. Well my line in the /etc/fstab file looks like this for the moment:

UUID="cea0b7ae-2fbc-4f01-8884-3cb5884c8bb7" /media/stockage ext4 defaults,nofail 0 0

Can I add your line under the one I already have ?

Then what I dont know is: what uid and gid to put in ?

EDIT: do I have to put uid=myusername and gid=www-group ?

if you want to R/W from nextcloud, put this:
uid=nextcloud
gid=nextcloud

Is there a way to have R/W for all apps, even apps I will install in the future ?

Update and resolved,

The best way I’ve found is to add an ACL permission on my folder:

$ setfacl -R -m u:www-data:rw /raid
$ setfacl -R -d -m u:www-data:rw /raid

I’ve got help for that on another forum: https://mondedie.fr/d/10545-debian-yunohost-permission-disque-interne

Now for example when Transimission create a folder, Nextcloud can r/w it.

1 Like

good!