From owner-freebsd-questions Sun Oct 26 23:54:45 1997 Return-Path: Received: (from root@localhost) by hub.freebsd.org (8.8.7/8.8.7) id XAA24287 for questions-outgoing; Sun, 26 Oct 1997 23:54:45 -0800 (PST) (envelope-from owner-freebsd-questions) Received: from david.siemens.de (david.siemens.de [139.23.36.11]) by hub.freebsd.org (8.8.7/8.8.7) with ESMTP id XAA24280 for ; Sun, 26 Oct 1997 23:54:42 -0800 (PST) (envelope-from Andre.Albsmeier@mchp.siemens.de) Received: from salomon.mchp.siemens.de (mail.siemens.de [139.23.33.13]) by david.siemens.de (8.8.7/8.8.7) with ESMTP id IAA21561 for ; Mon, 27 Oct 1997 08:50:03 +0100 (MET) Received: from curry.mchp.siemens.de (daemon@curry.mchp.siemens.de [146.180.31.23]) by salomon.mchp.siemens.de (8.8.7/8.8.5) with ESMTP id IAA24684 for ; Mon, 27 Oct 1997 08:54:33 +0100 (CET) Received: (from daemon@localhost) by curry.mchp.siemens.de (8.8.7/8.8.7) id IAA06821 for ; Mon, 27 Oct 1997 08:54:33 +0100 (MET) From: Andre Albsmeier Message-Id: <199710270754.IAA00631@curry.mchp.siemens.de> Subject: Re: Why is "chown -h -R" forbidden? In-Reply-To: from Doug White at "Oct 26, 97 11:42:44 pm" To: dwhite@resnet.uoregon.edu Date: Mon, 27 Oct 1997 08:54:20 +0100 (CET) Cc: freebsd-questions@freebsd.org X-Mailer: ELM [version 2.4ME+ PL32 (25)] MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: owner-freebsd-questions@freebsd.org X-Loop: FreeBSD.org Precedence: bulk > On Tue, 21 Oct 1997, Andre Albsmeier wrote: > > > When trying to run > > > > chown -h -R user.group file ... > > > > I get the message > > > > chown: the -R and -h options may not be specified together > > > > Why is this so? I want to pass a whole file hierarchy over > > to a user; including the symlinks (not what they point at). > > -R and -h are mutually exclusive. See chown(8); try the -H option. And I don't understand why. I assume that -P is the default (at least it is for find(1)). So, when descending down the hierarchy, IMHO it would make sense to allow -R and -h. This is what I wrote a few days ago to -hackers, however, I didn't get any reply until now... ----------------- snip ------------------------------ Hi, after asking on -questions why "chown -R -h" isn't allowed, I was told that this is due to the possibility that there might be symlinks which point to directories somewhere else. However, this might really be a problem, but only if the symlinks are followed. So if neither -L nor -H are specified, I think it would be safe to allow -h with -R. The diff's are quite simple: *** chown.c.ORI Wed Oct 22 11:35:40 1997 --- chown.c Tue Oct 21 20:23:30 1997 *************** *** 116,122 **** fts_options = FTS_PHYSICAL; if (Rflag) { ! if (hflag) errx(1, "the -R and -h options may not be specified together"); if (Hflag) fts_options |= FTS_COMFOLLOW; --- 116,122 ---- fts_options = FTS_PHYSICAL; if (Rflag) { ! if (hflag && (Lflag || Hflag) ) errx(1, "the -R and -h options may not be specified together"); if (Hflag) fts_options |= FTS_COMFOLLOW; I have tried it here and it works quite nice. The reason, why I like it is, to pass a whole directory over to another user; of course without the files the symlinks are pointing at. What do you think about that? -Andre