From owner-freebsd-bugs@FreeBSD.ORG Wed Mar 20 15:40:01 2013 Return-Path: Delivered-To: freebsd-bugs@smarthost.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 9A20C9AF for ; Wed, 20 Mar 2013 15:40:01 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:1900:2254:206c::16:87]) by mx1.freebsd.org (Postfix) with ESMTP id 73329F69 for ; Wed, 20 Mar 2013 15:40:01 +0000 (UTC) Received: from freefall.freebsd.org (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.6/8.14.6) with ESMTP id r2KFe1gJ026443 for ; Wed, 20 Mar 2013 15:40:01 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.6/8.14.6/Submit) id r2KFe0ei026442; Wed, 20 Mar 2013 15:40:00 GMT (envelope-from gnats) Date: Wed, 20 Mar 2013 15:40:00 GMT Message-Id: <201303201540.r2KFe0ei026442@freefall.freebsd.org> To: freebsd-bugs@FreeBSD.org Cc: From: Lowell Gilbert Subject: Re: kern/177087: Wrong gid on file creations X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list Reply-To: Lowell Gilbert List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Mar 2013 15:40:01 -0000 The following reply was made to PR kern/177087; it has been noted by GNATS. From: Lowell Gilbert To: Tuc Cc: Subject: Re: kern/177087: Wrong gid on file creations Date: Wed, 20 Mar 2013 11:34:45 -0400 Tuc writes: > On 2013-03-18 17:24, Lowell Gilbert wrote: >> Tuc writes: >> >>>>How-To-Repeat: >>> $ cd /tmp >>> $ touch foo >>> $ ls -l foo >>> -rw-r--r-- 1 tuc wheel 0 Mar 18 20:36 foo >>> $ grep tuc /etc/passwd >>> tuc:*:1001:1001:Tuc:/home/tuc:/bin/sh >>> $ id >>> uid=1001(tuc) gid=1001(tuc) groups=1001(tuc),0(wheel) >>> $ cd /var/tmp >>> $ touch foo >>> $ ls -l foo >>> -rw-r--r-- 1 tuc wheel 0 Mar 18 20:37 foo >>> >>> root@e-nfs-01:/root # mkdir /foo >>> root@e-nfs-01:/root # chmod 777 /foo >>> root@e-nfs-01:/root # exit >>> logout >>> $ cd /foo >>> $ touch foo >>> $ ls -l foo >>> -rw-r--r-- 1 tuc wheel 0 Mar 18 20:39 foo >> >> What group were you expecting? >> >> Those directories normally belong to the wheel group, so new >> subdirectories will be too. > > Expecting the primary group listed on my id. I guess I never realized > that it used the parents group. I expected it to give the id/group > that I belong to. On some systems (SystemV-ish), the euid/egid are used by default, and I think the sgid bit can be set on the directory to change that to the BSD style. The BSD behaviour is the only one that POSIX requires. I believe that ACLs can be used to get the type of permissions you want, but I don't know the syntax offhand. > The basis of the reason for my interest is that I'm trying to use > NAS4Free, and when I create a volume and export it out NFS, every file > is getting the wheel group there too. I'm expecting it to pick up the > group of the user like our NetApp does. I tested on Linux, and when I > do the same things in /foo it creates it with my id/group, not the one > above. If I was to just use a normal FreeBSD NFS setup, how can I make > it pick up the user/group of the person creating the file (We are > using it exported to a farm of CentOS...We wanted FreeBSD due to ZFS). Normally, for directories where anyone can create their own files or directories, we use the sticky bit. /tmp is set up this way, for example. And normally every account has a home directory, owned by them and their personal group.