From owner-freebsd-questions@FreeBSD.ORG Fri Feb 8 08:46:36 2008 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 07CF116A420 for ; Fri, 8 Feb 2008 08:46:36 +0000 (UTC) (envelope-from jonathan+freebsd-questions@hst.org.za) Received: from hermes.hst.org.za (onix.hst.org.za [209.203.2.133]) by mx1.freebsd.org (Postfix) with ESMTP id 3347813C468 for ; Fri, 8 Feb 2008 08:46:33 +0000 (UTC) (envelope-from jonathan+freebsd-questions@hst.org.za) Received: from sysadmin.hst.org.za (sysadmin.int.dbn.hst.org.za [10.1.1.20]) (authenticated bits=0) by hermes.hst.org.za (8.13.8/8.13.8) with ESMTP id m188dE6q081025 (version=TLSv1/SSLv3 cipher=RC4-MD5 bits=128 verify=NO) for ; Fri, 8 Feb 2008 10:39:15 +0200 (SAST) (envelope-from jonathan+freebsd-questions@hst.org.za) From: Jonathan McKeown Organization: Health Systems Trust To: freebsd-questions@freebsd.org Date: Fri, 8 Feb 2008 10:54:40 +0200 User-Agent: KMail/1.7.2 References: <47AB48CF.1020804@gahr.ch> <47AB50FB.8020900@gahr.ch> <6E924673-19E3-4CD2-9FE0-242E87FBE2D2@mac.com> In-Reply-To: <6E924673-19E3-4CD2-9FE0-242E87FBE2D2@mac.com> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200802081054.40808.jonathan+freebsd-questions@hst.org.za> X-Spam-Score: -4.35 () ALL_TRUSTED,AWL,BAYES_00 X-Scanned-By: MIMEDefang 2.61 on 209.203.2.133 Subject: Re: cp -p X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Feb 2008 08:46:36 -0000 On Thursday 07 February 2008 20:07, Pietro Cerutti wrote: > HostServer exports via NFS /www, which belongs to user:www > (uid=1001, gid=80). The directory has the segid flag set: > > drwsr-xr-x 13 user www 512 Feb 7 00:58 www > > HostClient mounts the exported directory on /share/www. HostClient > doesn't know anything about gid 80. > > Now, on HostClient, user copies aFile to /share/www using the -p flag of > cp(1). > > > cp -p aFile /share/www/ > > ls -l > > -rw------- 1 user user 2981888 Feb 7 01:09 /www/aFile > > As shown, the setgid flag of /www hasn't worked. Hang on - you asked cp to preserve the user and group ownership of the file (cp -p). As far as I can see, it's done what you asked it to. I would regard any other result as violating the Principle of Least Astonishment. and on Thursday 07 February 2008 20:48, Chuck Swiger wrote: > On Feb 7, 2008, at 10:42 AM, Pietro Cerutti wrote: > > From HostClient: > >> ls -al /share/ > > > > drwxr-sr-x 4 User www 512 Feb 7 19:23 www > > > >> touch /share/www/foo > >> ls -l /share/www/foo > > > > -rw-r----- 1 user www 0 Feb 7 19:39 /share/www/foo > > > > (group id works) > > Right, this is the BSD setgid semantics one would expect. Surely the BSD way is always to inherit group ownership from the directory? setgid is only used on SYSV systems to emulate the BSD semantics on a per-directory basis - or have I got this completely wrong? Jonathan