Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 13 Aug 2005 01:11:11 -0500
From:      Dan Nelson <dnelson@allantgroup.com>
To:        Mike Meyer <mwm-keyword-hackers.e471b2@mired.org>
Cc:        hackers@freebsd.org, Jo~ao Carlos Mendes Luis <jonny@jonny.eng.br>
Subject:   Re: File create permissions, what am I missing?
Message-ID:  <20050813061111.GA46146@dan.emsphone.com>
In-Reply-To: <17149.15219.714658.707699@bhuda.mired.org>
References:  <42FD15EA.8050500@jonny.eng.br> <20050812233728.GA22225@odin.ac.hmc.edu> <17149.15219.714658.707699@bhuda.mired.org>

next in thread | previous in thread | raw e-mail | index | archive | help
In the last episode (Aug 12), Mike Meyer said:
> In <20050812233728.GA22225@odin.ac.hmc.edu>, Brooks Davis <brooks@one-eyed-alien.net> typed:
> > On Fri, Aug 12, 2005 at 06:34:34PM -0300, Jo~ao Carlos Mendes Luis wrote:
> > > In a directory with -rwxrwxrwx, any user can create files, but
> > > who should be the owner/group of this file?
> > 
> > On BSD systems, the group of a file is always the group of the
> > directory it is in.  This differs from SysV UNIX.  The resident
> > grey-beard at work feels this is a new and annoying behavior. (i.e.
> > it wasn't always this way. :)
> 
> SysV lets you toggle that behavior on a per-directory basis. Turn the
> setgid bit on in the directory, and files created in it will be owned
> by the group that owns the directory.

Unfortunately, FreeBSD doesn't honor the "subdirectories created under
SGID subdirectories inherit the flag" rule, so you can't serve SysV
clients from FreeBSD NFS hosts without the permissions getting screwed
up (SysV clients expect the nfs server to set the bit).  Fix:

RCS file: /home/ncvs/src/sys/ufs/ufs/ufs_vnops.c,v
retrieving revision 1.271
diff -u -r1.271 ufs_vnops.c
--- ufs_vnops.c 9 Jun 2005 20:20:31 -0000       1.271
+++ ufs_vnops.c 14 Jun 2005 18:22:01 -0000
@@ -1336,6 +1336,8 @@
        ip = VTOI(tvp);
        ip->i_gid = dp->i_gid;
        DIP_SET(ip, i_gid, dp->i_gid);
+       if (dp->i_mode & ISGID) 
+               dmode |= ISGID;
 #ifdef SUIDDIR
        {
 #ifdef QUOTA

-- 
	Dan Nelson
	dnelson@allantgroup.com



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20050813061111.GA46146>