I use the following setup:
NFS Server (Ubuntu 16.04 LTS)
- nfs-common 1:1.2.8-6ubuntu1.2
- nfs-kernel-server 1:1.2.8-6ubuntu1.2
- user: test (uid=1300)
NFS Client
- nfs-common 1:1.3.4-2.1
- user: testmf (uid=1350)
On the client side, the user test
exists with the same UID as in the server side. But I need to use the user testmf
and not the test
one.
I have read a lot documentation, and answers from StackOverflow/StackExchange, and for some reasons nothing works for me.
One of the many answers is to change the file /etc/idmapd.conf
.
So here it is on both side:
Server
[General]
Verbosity = 0
Pipefs-Directory = /run/rpc_pipefs
# set your own domain here, if id differs from FQDN minus hostname
# Domain = localdomain
[Mapping]
Nobody-User = nobody
Nobody-Group = nogroup
On the client side:
[General]
Verbosity = 9
Pipefs-Directory = /run/rpc_pipefs
# set your own domain here, if it differs from FQDN minus hostname
# Domain = localdomain
Domain = example.com
[Mapping]
Nobody-User = nobody
Nobody-Group = nogroup
[Translation]
Method = static
[Static]
test@nfsserver.example.com = testmf
test@192.168.0.1 = testmf
test@nfsserver = testmf
And I use such command to mount the directory on the client:
mount 192.168.0.1:/home/test/my_exp_dir /home/testmf/my_imp_dir
And when I do a ls -l /home/testmf/my_imp_dir
I get something like that:
-rw-r--r-- 1 test test 326025780 May 9 2017 allCountries.zip
and NOT
-rw-r--r-- 1 testmf testmf 326025780 May 9 2017 allCountries.zip
If I do a this point a touch testfile
I get that:
-rw-r--r-- 1 test test 326025780 May 9 2017 allCountries.zip
-rw-r--r-- 1 testmf testmf 0 Jun 9 18:57 testfile
Or ls -ln
-rw-r--r-- 1 1300 1300 326025780 May 9 2017 allCountries.zip
-rw-r--r-- 1 1350 1350 0 Jun 9 18:57 testfile
I tried to increase the level of verbosity, and nowhere in my logs I can see the mapping of users from one UID to another like I could see on some answers.
The two things I could see is that the kernel setting /sys/module/nfs/parameters/nfs4_disable_idmapping
was set to Y
and even after changing to N
, nothing seems to work.
The second thing that I have found is the 2 entries doesn't exist on my client server:
- /proc/net/rpc/nfs4.nametoid
- /proc/net/rpc/nfs4.idtoname
And I don't know how to add it, especially if the nfsidmap is not available.
I have read that I also need to restart the idmapd
service after that change. But in Debian 9 there it is not possible... Or at least I have not found how to do it...
I have also changed the file /etc/default/nfs-common
to set the variable NEED_IDMAPD=yes
and it doesn't do anything, even after a reboot...
So my question is maybe quite dumb, but how can I activate nfsidmapd on Debian Stretch? I am really out of option, search keywords and the official documentation of Debian is not really helpful here, except if I am totally blind!
Thank you in advance for your help.