From owner-freebsd-hackers@FreeBSD.ORG Sun Oct 3 00:19:54 2004 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 6707016A4CE; Sun, 3 Oct 2004 00:19:54 +0000 (GMT) Received: from VARK.MIT.EDU (VARK.MIT.EDU [18.95.3.179]) by mx1.FreeBSD.org (Postfix) with ESMTP id 9946243D1D; Sun, 3 Oct 2004 00:19:53 +0000 (GMT) (envelope-from das@FreeBSD.ORG) Received: from VARK.MIT.EDU (localhost [127.0.0.1]) by VARK.MIT.EDU (8.13.1/8.12.10) with ESMTP id i930K8AE003127; Sat, 2 Oct 2004 20:20:08 -0400 (EDT) (envelope-from das@FreeBSD.ORG) Received: (from das@localhost) by VARK.MIT.EDU (8.13.1/8.12.10/Submit) id i930K8W8003126; Sat, 2 Oct 2004 20:20:08 -0400 (EDT) (envelope-from das@FreeBSD.ORG) Date: Sat, 2 Oct 2004 20:20:08 -0400 From: David Schultz To: Giorgos Keramidas Message-ID: <20041003002007.GA3070@VARK.MIT.EDU> Mail-Followup-To: Giorgos Keramidas , Garance A Drosihn , freebsd-hackers@FreeBSD.ORG, Lee Harr References: <20041002175704.GB2230@gothmog.gr> <20041002230226.GC1381@gothmog.gr> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20041002230226.GC1381@gothmog.gr> cc: Lee Harr cc: freebsd-hackers@FreeBSD.ORG cc: Garance A Drosihn Subject: Re: Protection from the dreaded "rm -fr /" X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 03 Oct 2004 00:19:54 -0000 On Sun, Oct 03, 2004, Giorgos Keramidas wrote: > On 2004-10-02 17:22, Garance A Drosihn wrote: > > At 8:57 PM +0300 10/2/04, Giorgos Keramidas wrote: > > >On 2004-10-02 21:23, Lee Harr wrote: > > >> How about: > > >> chflags sunlnk / > > >> ? > > > > > >Setting sunlink on / will only protect the / directory, not its > > >descendants, so you don't gain much. > > > > We could add a new flag "srunlnk", or maybe even "srm-r". The "rm" > > command will always have to stat() the file it is given (just to > > see if it is a directory), so it could check to see if this flag > > is turned on. If it is turned on, then 'rm' could refuse to honor > > any '-rf' request on that directory. [...] > > Hmmm. This sounds much better indeed :-) Give a choice between an elegant 50-line solution involving kernel changes and a somewhat inelegant but complete 3-line solution, I have to say I'd opt for the 3-line solution...