From owner-freebsd-hackers@FreeBSD.ORG Sat Oct 2 08:52:25 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 D346016A4CE for ; Sat, 2 Oct 2004 08:52:25 +0000 (GMT) Received: from node15.coopprint.com (node15.cooperativeprinting.com [208.4.77.15]) by mx1.FreeBSD.org (Postfix) with SMTP id 5352143D53 for ; Sat, 2 Oct 2004 08:52:25 +0000 (GMT) (envelope-from ryans@gamersimpact.com) Received: (qmail 47456 invoked by uid 0); 2 Oct 2004 08:51:54 -0000 Received: from unknown (HELO ?192.168.0.5?) (63.231.165.205) by node15.coopprint.com with SMTP; 2 Oct 2004 08:51:54 -0000 Message-ID: <415E6C4A.1010804@gamersimpact.com> Date: Sat, 02 Oct 2004 03:52:26 -0500 From: Ryan Sommers User-Agent: Mozilla Thunderbird 0.7.3 (Windows/20040803) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Edwin Groothuis References: <20041002081928.GA21439@gothmog.gr> <20041002083336.GA10355@k7.mavetju> In-Reply-To: <20041002083336.GA10355@k7.mavetju> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit cc: freebsd-hackers@FreeBSD.org cc: Giorgos Keramidas 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: Sat, 02 Oct 2004 08:52:26 -0000 Edwin Groothuis wrote: >On Sat, Oct 02, 2004 at 11:19:28AM +0300, Giorgos Keramidas wrote: > > >>John Beck, who works for Sun, has posted an entry in his blog yesterday >>about "rm -fr /" protection, which I liked a lot: >>http://blogs.sun.com/roller/page/jbeck/20041001#rm_rf_protection >> >>His idea was remarkably simple, so I went ahead and wrote this patch for >>rm(1) of FreeBSD: >> >> > >I'm not so much worried about 'rm -rf /', but I'm more worried about >"rm -rf *" in my home directory. It happened once because I was too >happy switching directories before realising what I was doing in >the wrong directory. > >Also, refusing to do it is not the ideal way to go, I think that >if you have two -f's specified it would do it anyway. Just my two >cents of course. > >Edwin > > If you use tcsh for your shell add: set rmstar to your .cshrc file. Then anytime you use '*' as an argument to rm it will ask you if you are sure you want to do that. As for adding this kind of oops-proofing. I'm not sure I like the idea of completely removing the ability to use / as an argument. How about prompting and needing 'yes' as input? -- Ryan Sommers ryans@gamersimpact.com