Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
NFS uid & gid mapping
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Networking & Security
View previous topic :: View next topic  
Author Message
bourane
n00b
n00b


Joined: 25 Mar 2007
Posts: 30

PostPosted: Sun Oct 06, 2013 9:14 am    Post subject: NFS uid & gid mapping Reply with quote

Hi people !

I have trouble configuring NFS server. I have two computers :
Silver, a fanless server/multimedia box which run under gentoo (custom monolithic kernel)
Code:
Linux silver 3.10.7-gentoo #3 SMP Sat Oct 5 11:29:03 CEST 2013 x86_64 AMD E-450 APU with Radeon(tm) HD Graphics AuthenticAMD GNU/Linux

Thor, my old laptop running gentoo as well (custom monolithic kernel too)
Code:
Linux thor 3.5.7-gentoo #3 SMP PREEMPT Fri Apr 5 19:27:30 CEST 2013 x86_64 Intel(R) Core(TM)2 CPU T5600 @ 1.83GHz GenuineIntel GNU/Linux


My server holds every medias i have. I made a smb share in a minute to let my flatmates access it from their computer but i would like to use proper NFS with my laptop.

So I installed nfs-utils and built nfs server & client support (version 3 and 4) into both of my kernels.
I exported the share on my server with the all_squash option:
Code:
/mnt/data/test thor(rw,insecure,no_subtree_check,sync,anongid=1001,anonuid=1001,all_squash)

Code:
silver test # less /etc/passwd | grep thomas
thomas:x:1001:1001::/home/thomas:/bin/bash

Code:
silver test # less /etc/group | grep thomas
[...]
thomas:x:1001:jeremie,brittany


Well it did not work as I excepted: no write access even after a
chown -R thomas.thomas on server side.

I figured out that is because of nfsV4 which does not handle squashing correctly (so why no error is reported throug dmesg ???) even with forcing v3 mount with nfsvers option i still had trouble. I removed nfsv4 from my server's kernel and i was able to access to the share properly.

Code:
thomas@thor(10:44:29) /mnt/work $ mount -l
[...]
silver:/mnt/data/test on /mnt/work type nfs (rw,addr=192.168.0.8)

thomas@thor(10:43:52) /mnt/work $ ls -l
total 8
drwxr-xr-x 2 root   root       4096 Oct  6 10:39 root_dir
-rw-r--r-- 1 root   root          0 Oct  6 10:39 root_file
drwxr-xr-x 2 invite messagebus 4096 Oct  6 10:38 thomas_dir
-rw-r--r-- 1 invite messagebus    0 Oct  6  2013 thomas_file
thomas@thor(10:44:05) /mnt/work $ groups
root sys wheel audio cdrom video games cdrw usb thomas plugdev amis kvm
thomas@thor(10:44:09) /mnt/work $ touch thomas_dir/remote_thomas_file

Code:
thomas@silver /mnt/data/test $ ls -l thomas_dir/
total 0
-rw-r--r-- 1 thomas thomas 0  6 oct.  10:45 remote_thomas_file


as you can see, reading files and writing is not a problem anymore and work as excepted but uid&gid mapping is bad.

on client side i have
Code:
thor(10:56:45) /home/thomas # less /etc/group | grep 1001
messagebus:x:1001:
thor(11:01:03) /home/thomas # less /etc/passwd | grep 1001
messagebus:x:101:1001:added by portage for dbus:/dev/null:/sbin/nologin
invite:x:1001:1013::/home/invite:/bin/bash


I have tried static_map but nfs complains about it
Code:
silver ~ # /etc/init.d/nfs restart
 * Caching service dependencies ...                                                                                                                                            [ ok ]
 * Stopping NFS mountd ...                                                                                                                                                     [ ok ]
 * Stopping NFS daemon ...                                                                                                                                                     [ ok ]
 * Unexporting NFS directories ...                                                                                                                                             [ ok ]
 * Exporting NFS directories ...
exportfs: /etc/exports:2: unknown keyword "map_static=/etc/nfs.map"


What did i missed ? Any ideas ?
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Networking & Security All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum