nfs gid is always 0

Status
Not open for further replies.

bbk

Cadet
Joined
Oct 17, 2013
Messages
8
I use FreeNAS 9.1.1 and i share a zfs dataset with nfs. The user nfslocal and the group has the id 2300.

On the FreeNAS (#) the exports looks like the following:

# cat /etc/exports
/mnt/myvol/mydataset -maproot=nfslocal:nfslocal -network 192.168.30.0/24

The directory which is shared has the following permissions set:

# ls -lahrtd /mnt/myvol/mydataset/
drwxrwxrwx 2 root wheel 17B Oct 17 13:45 /mnt/myvol/mydataset/

Now on the linux client side (>>) when i create a file as restricted user or as root the gid is always 0.

As user:

>> touch test.txt
>> id
uid=44380(myuser) gid=3500(mygroup) groups=3500(mygroup) context=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023

>> ls -lahrtn
total 13K
-rw-------. 1 44380 0 0 17. Okt 16:22 test.txt
drwxrwxrwx. 2 0 0 3 17. Okt 16:39 .
drwxr-xr-x. 3 0 0 0 18. Okt 09:06 ..

Or as root:

>> touch test_as_root.txt
>> id
uid=0(root) gid=0(root) groups=0(root) context=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023

>> ls -lahrtn
total 13K
drwxr-xr-x. 3 0 0 0 Oct 18 09:06 ..
-rw-r--r--. 1 2300 0 0 Oct 18 09:09 test_as_root.txt
drwxrwxrwx. 2 0 0 3 Oct 18 09:09

The users and groups on the FreeNAS are imported from ldap and are available:

# getent group |grep nfslocal
nfslocal:*:2300

# getent passwd |grep nfslocal
nfslocal:*:2300:2300:Installation User:/u/nfslocal:/bin/sh

I don't know what i have to configure that i can get it to work... i have found a NAS4Free bugreport maybe the same is valid for FreeNAS:

* http://sourceforge.net/p/nas4free/bugs/88/
 

bbk

Cadet
Joined
Oct 17, 2013
Messages
8
In the webinterface i have configured the following:

Comment -> none
Authorized networks -> 192.168.30.0/24
Authorized IP addresses or hosts -> none
All Directories -> not checked
Read Only -> not checked
Quiet -> not checked
Maproot User -> nfslocal (which is uid 2300)
Maproot Group -> nfslocal (which is gid 2300)
Mapall User -> none
Mapall Group -> N/A
Path -> /mnt/myvol/mydataset

This leads to the following /etc/exports on the FreeNAS:

# cat /etc/exports
/mnt/myvol/mydataset -maproot=nfslocal:nfslocal -network 192.168.30.0/24
 

bbk

Cadet
Joined
Oct 17, 2013
Messages
8
The following is the configuration of the nfs service (which i left as it was per default):

Number of servers -> 4
Allow non-root mount -> none
Bind IP Addresses -> none
mountd(8) bind port -> none
rpc.statd(8) bind port -> none
rpc.lockd(8) bind port -> none

I also discovered when i change the group of a folder it will create all files in the group of this parent folder (like the sticky bit?), even if my user is not in the corresponding group:

On the FreeNAS, i change the group of the folder tests to 2072:
# ls -lahrtn /mnt/myvol/mydataset
total 36
drwxr-x--- 2 44380 2072 2B Oct 18 10:27 tests
drwxr-xr-x 3 0 0 3B Oct 18 10:27 .
drwxr-xr-x 4 0 0 4B Oct 18 11:53 ..

On the Client (and on the FreeNAS), my users is not in the group id 2072, but when i create a file inside this folder it belongs to the group id 2072:

>> id myuser
uid=44380(myuser) gid=3500(mygroup) groups=3500(mygroup)
>> touch test.txt
>> ls -lahrtn
total 25K
drwxr-xr-x. 3 0 0 3 18. Okt 10:27 ..
-rw-------. 1 44380 2072 0 18. Okt 13:41 test.txt
drwxr-x---. 2 44380 2072 3 18. Okt 13:41 .

I guess i have missconfigured something... but i don't know where...
 

bbk

Cadet
Joined
Oct 17, 2013
Messages
8
I still try to narrow down the problem, but i don't find any hint, what i did wrong (but i have to admit i am maybe not the best google search string composer).

Maybe i have to reformulate my problem, to get more attention:

maproot Group don't work.

To specify: it always creates file with the gid of the folder.

If someone has any hint... i am really pleased to know.
 

bbk

Cadet
Joined
Oct 17, 2013
Messages
8
I installed a fresh freebsd 9.2 and set up nfs:

vi /etc/rc.conf

rpcbind_enable="YES"
nfs_server_enable="YES"
mountd_enable="YES"
mountd_flags="-r"
rpc_lockd_enable="YES"
rpc_statd_enable="YES"

With this i have the same error so i went to a fresh Fedora 19 installation and setup a nfs server and mounted with nfs3:


yum install nfs-utils

systemctl start rpcbind.service
systemctl enable nfs-server.service
systemctl start nfs-lock.service
systemctl start nfs-idmap.service

Here i don't have this problem!

I will try to digg deeper... if i should stop posting my findings here, tell me and i will.

Cheers
 

bbk

Cadet
Joined
Oct 17, 2013
Messages
8
Finally i found someone having the same lack of knowledge i had:

* http://www.freebsd.org/cgi/query-pr.cgi?pr=177087

It looks like this is the expected behavior on a BSD system, so maybe the

* Maproot Group
* Mapall Group

are useless in the nfs share settings.

I still wonder how to solve my need. I have to create a folder where 300 user can mount with nfs, they can create files and folders. All of them need to have their primary group. I will start a new thread for this question.

Thank you for your time...
 
D

dlavigne

Guest
Please create a report at bugs.freenas.org and post the issue number here. A dev wants to take a closer look at this and the ticket will make sure he doesn't forget.
 
Status
Not open for further replies.
Top