From owner-freebsd-hackers@FreeBSD.ORG Tue Oct 5 16:03:27 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 39E4F16A4CE; Tue, 5 Oct 2004 16:03:27 +0000 (GMT) Received: from athena.softcardsystems.com (mail.softcardsystems.com [12.34.136.114]) by mx1.FreeBSD.org (Postfix) with ESMTP id BA57D43D41; Tue, 5 Oct 2004 16:03:26 +0000 (GMT) (envelope-from sah@softcardsystems.com) Received: from athena (athena [12.34.136.114])i95H2ErI011534; Tue, 5 Oct 2004 12:02:14 -0500 Date: Tue, 5 Oct 2004 12:02:14 -0500 (EST) From: Sam X-X-Sender: sah@athena To: Chris Dillon In-Reply-To: <20041005103123.C46325@duey.wolves.k12.mo.us> Message-ID: References: <20041002081928.GA21439@gothmog.gr> <200410021123.59811.max@love2party.net> <20041002101842.GA23272@gothmog.gr> <20041005103123.C46325@duey.wolves.k12.mo.us> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed cc: Max Laier cc: Giorgos Keramidas cc: freebsd-hackers@freebsd.org cc: Ryan Sommers 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: Tue, 05 Oct 2004 16:03:27 -0000 >> As for protecting against "rm -rf / foo" as a typo for "rm -rf /foo", I >> don't mind if we offer protection against that; but I see no reason at all >> to "protect" root from "rm -rf /". It's fair to say that somebody who >> types that means it, and it's fair to go as far as we can in satisfying it. > > I think you just nailed it on the head right here... if you say "rm -rf /" > you probably mean it, but if you say "rm -rf / foo" you probably oopsed > (pretty good bet, since rm / makes asking to rm foo redundant). How about > checking if there is more than one argument, and if one of those arguments is > "/", fail. If there is only one argument, even if it is "/", assume the user > knows what he is doing and proceed normally. Why not let -i override -f? Then the usual alias bit works fine for those who want it. For times when you really want the -f, you can type /bin/rm -rf. Or `which rm` -rf. Or put it in a shell script and call it rmf. There are a lot of ways to skin this properly without resorting to hacks making the tool smarter than the user. Sam