how to get user permissions for nfs share?
Let usera
be the primary group of UserA (groups usera
). You can find out the GID using: id -g usera
on the client system, say it is 1256
. Now add your user to the usera
group:
sudo adduser ayven usera
Now, on the server, do:
chown :1256 /Directory # Replace 1256 with the correct GID
chmod g+rwxs /Directory
Remount it on the client:
sudo umount /Directory
sudo mount /Directory
(You might have to relogin for your new groups to take effect.)
Now both you and usera
have complete access to the NFS share. I have used the setgid
bit, so you may have to enable it, I don't remember it. Add any users you wish to have access to this directory to the usera
group.
Related videos on Youtube
AyvenRedwing
Updated on September 18, 2022Comments
-
AyvenRedwing over 1 year
The situation: I simply want to be able to access a Synology NAS from an Ubuntu Server with a non-root user.
On the NAS I have this in the exports-file:
/Directory <client-ip>/255.255.255.0(rw,async,no_wdelay,no_root_squash,insecure_locks,sec=sys,anonuid=1003,anongid=1004)
On the Ubuntu-Server in fstab I got this:
<server-ip>:/Directory /Mountpoint nfs noauto,user,rw 0 0
Now I want to allow UserA, which is used for some automatic processes to mount the share and write to it.
mount /Mountpoint
Mounting as UserA works fine, but I have no permission to even read what's in the directory. As user root I do. Listing the mountpoint folder shows these permissions:
drwxrwx--- 4 UserA root 4096 Sep 17 13:58 Mountpoint
I tried to set the anon-ids in the exports to the ids of UserA, but that didn't help. Making UserA the owner of the folder didn't help either. Is there a simple thing I am missing?
Also: This needs to be an nfs share as it will transfer large amounts of data.
Edit: I would prefer to avoid giving read and write permissions to "others" for security reasons.