Permissions on NFS share

TrueChris

Cadet
Joined
Dec 12, 2021
Messages
8
Hello,

I've set up TrueNAS, added a pool, a dataset and created a share. This is mounted on a Linux client.

Code:
root@truenas[~]# cat /etc/exports
V4: / -sec=sys
/mnt/tank/nemesisdata -maproot="nemesisnfs":"nemesisnfs" 192.168.0.13

Code:
root@nemesis:/home/chris# mount -t nfs -o nfsvers=4 -o sec=sys 192.168.0.81:/mnt/tank/nemesisdata /mnt/nfs/

This basically works for reading and writing when the permissions on a folder or file are what the connected user is mapped to. So I can read/write files on the client in the share with that user where it's allowed for nemesisnfs.
On TrueNAS I created user and groups nemesisnfs and seafile and they also exist on the client. I also see the users of directories and files created on TrueNAS displayed ok, so no nobody or such.

What doesn't work is writing to a directory where only user seafile has write rights. For debugging set permissions to 777 to see what other users are recognized as and got this:
Code:
chris@nemesis:~$ sudo -u seafile touch /mnt/nfs/seafile-data/test

on the client leads to viewed on the server:
Code:
root@truenas[~]# ls -la /mnt/tank/nemesisdata/seafile-data
drwxrwxrwx  2  seafile       seafile      3 Dec 12  19:33 .
drwxr-xr-x  2  nemesisnfs    nemesisnfs   3 Dec 12  19:31 ..
-rw-r--r--  1  1006          seafile      0 Dec 12 19:33 test


1006 is the uid for seafile on the client whereas on the server it's 1001.

On the client it looks as follows:
Code:
root@nemesis:/home/chris# la /mnt/nfs/seafile-data/
drwxrwxrwx 2 seafile    seafile    4 12. Dez 19:51 .
drwxr-xr-x 6 nemesisnfs nemesisnfs 6 12. Dez 19:31 ..
-rw-r--r-- 1 nobody     seafile    0 12. Dez 19:33 test

So when the client tries to write as user seafile the id mapping isn't done right, but when viewing files on the share the mapping is ok.

I do have the nfs-idmapd running and set Domain in the /etc/idmapd.conf to the same domain as in the TrueNAS Global Configuration. But if the point is, that this mapping doesn't work, how can I debug it? Any ideas?

Regards,
Chris
 
Joined
Jan 7, 2015
Messages
1,155
So you should change the user seafile UID to 1006 according to the server. Something like this from the TN host cli should help.

pw usermod seafile -n seafile -u 1006
 

TrueChris

Cadet
Joined
Dec 12, 2021
Messages
8
But shouldn't one advantage of nfs4 not be that it doesn't require the uid/gid to be in sync but instead looks at the names only?
 
Top