Re: Protection from the dreaded "rm -fr /"

2004-10-28 Thread Lyndon Nerenberg
--On 2004-10-2 11:19 AM +0300 Giorgos Keramidas <[EMAIL PROTECTED]> 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 The best protection from 'rm -rf /'

Re: Protection from the dreaded "rm -fr /"

2004-10-06 Thread Thomas Sparrevohn
On Wednesday 06 October 2004 02:31, Matthew Dillon wrote: The university I used to work for had something like it and it got 99% of the cases > Yow. 78 messages and counting. Er, 79 now. I'll bet poor Giorgos > wishes he never started this thread! Get ready. get set DIVE! >

Re: rm -I patch (Re: Protection from the dreaded "rm -fr /")

2004-10-05 Thread Matthew Dillon
Here is the final commit I made to DFly. I cleaned up the confirmation message somewhat to make it more useful and correct the grammer. I'm not saying that this should or should not be done in FreeBSD, but I cannot think of any negatives and the -I option does allow for a far

rm -I patch (Re: Protection from the dreaded "rm -fr /")

2004-10-05 Thread Matthew Dillon
I think I'll commit something like this to DragonFly (you might get patch errors w/ FreeBSD but this is the basic idea). -Matt Index: rm.1 === RCS file: /cvs/src/bin/rm/rm.1,v retrievi

Re: Protection from the dreaded "rm -fr /"

2004-10-05 Thread Matthew Dillon
Yow. 78 messages and counting. Er, 79 now. I'll bet poor Giorgos wishes he never started this thread! Get ready. get set DIVE! A good friend of mine has, for at least the last two decades, used something along the lines of: if ( $?prompt ) then alias

Re: Protection from the dreaded "rm -fr /"

2004-10-05 Thread Giorgos Keramidas
On 2004-10-06 03:12, Giorgos Keramidas <[EMAIL PROTECTED]> wrote: > On 2004-10-05 10:37, Chris Dillon <[EMAIL PROTECTED]> wrote: > > I no longer have any interest in working towards any sort of change > related to this thread. Please do not Cc: me when replying. I'm not picking on Chris Dillon he

Re: Protection from the dreaded "rm -fr /"

2004-10-05 Thread Giorgos Keramidas
On 2004-10-05 10:37, Chris Dillon <[EMAIL PROTECTED]> wrote: > 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

Re: Protection from the dreaded "rm -fr /"

2004-10-05 Thread Sam
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

Re: Protection from the dreaded "rm -fr /"

2004-10-05 Thread Chris Dillon
On Sat, 2 Oct 2004, Greg Black wrote: 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

Re: Protection from the dreaded "rm -fr /"

2004-10-04 Thread Chris Howells
On Monday 04 October 2004 09:08, Mark Murray wrote: > Yeah. > > $ alias rm="rm -i" > > and you get the annoying  "confirm all deletes" behaviour. Remember that -r over-rides -i, so the warning does not appear: bash-2.05b$ mkdir blah bash-2.05b$ rm -irf blah bash-2.05b$ mkdir blah bash-2.05b$ rm -

Re: Protection from the dreaded "rm -fr /"

2004-10-04 Thread Søren Schmidt
Ceri Davies wrote: On Mon, Oct 04, 2004 at 08:27:45PM +1000, Dave Horsfall wrote: On Mon, 4 Oct 2004, Dmitry Karasik wrote: I just wonder, if 'rm' is so fearful to you, why bother changing rm(1)? Write a simple wrapper around, as many sysadmins do for their needs, and use it instead of rm. Precise

Re: Protection from the dreaded "rm -fr /"

2004-10-04 Thread Ceri Davies
On Mon, Oct 04, 2004 at 08:27:45PM +1000, Dave Horsfall wrote: > On Mon, 4 Oct 2004, Dmitry Karasik wrote: > > > I just wonder, if 'rm' is so fearful to you, why bother changing rm(1)? > > Write a simple wrapper around, as many sysadmins do for their needs, and > > use it instead of rm. > > Preci

Re: Protection from the dreaded "rm -fr /"

2004-10-04 Thread Stijn Hoop
On Mon, Oct 04, 2004 at 01:49:51PM +0300, Giorgos Keramidas wrote: > I've lost interest in making any sort of changes to rm(1) after the first > dozen or so of messages like this one. Don't get too disappointed: http://www.freebsd.org/cgi/cvsweb.cgi/src/bin/rm/rm.c.diff?r1=1.48&r2=1.49 changes b

Re: Protection from the dreaded "rm -fr /"

2004-10-04 Thread Giorgos Keramidas
On 2004-10-04 12:15, Dmitry Karasik <[EMAIL PROTECTED]> wrote: > On 02 Oct 04 at 10:51, "Giorgos" (Giorgos Keramidas) wrote: > Giorgos> The reason I liked this idea is that root has zillions of other > Giorgos> ways to destroy an entire system, but not many of them are likely > Giorgos> to be the r

Re: Protection from the dreaded "rm -fr /"

2004-10-04 Thread Dave Horsfall
On Mon, 4 Oct 2004, Dmitry Karasik wrote: > I just wonder, if 'rm' is so fearful to you, why bother changing rm(1)? > Write a simple wrapper around, as many sysadmins do for their needs, and > use it instead of rm. Precisely. This is -hackers; why do we need to be protected from ourselves? You

Re: Protection from the dreaded "rm -fr /"

2004-10-04 Thread Dmitry Karasik
Hi Giorgos! On 02 Oct 04 at 10:51, "Giorgos" (Giorgos Keramidas) wrote: Giorgos> The reason I liked this idea is that root has zillions of other Giorgos> ways to destroy an entire system, but not many of them are likely Giorgos> to be the result of mistyping a single character as shown

Re: Protection from the dreaded "rm -fr /"

2004-10-04 Thread Mark Murray
Thomas David Rivers writes: > If I'm remembering correctly - the historical way to > do this is to alias the "rm" command to something that > else that checks the arguments and complains appropriately > (and then executes /bin/rm.) Typically with just a shell > alias. That keeps you from a

Re: Protection from the dreaded "rm -fr /"

2004-10-03 Thread M. Warner Losh
In message: <[EMAIL PROTECTED]> [EMAIL PROTECTED] (Dag-Erling Smørgrav) writes: : "M. Warner Losh" <[EMAIL PROTECTED]> writes: : > rm doesn't have to live in the chroot. Consider : > chroot /some/path/to/a/chroot rm -rf / : > in this case, everything under the /some/path/to/a/chroo

Re: Protection from the dreaded "rm -fr /"

2004-10-03 Thread Roman Neuhauser
# [EMAIL PROTECTED] / 2004-10-03 02:02:26 +0300: > On 2004-10-02 17:22, Garance A Drosihn <[EMAIL PROTECTED]> wrote: > > At 8:57 PM +0300 10/2/04, Giorgos Keramidas wrote: > > >On 2004-10-02 21:23, Lee Harr <[EMAIL PROTECTED]> wrote: > > >> How about: > > >> chflags sunlnk / > > >> ? > > > > > >Set

Re: Protection from the dreaded "rm -fr /"

2004-10-03 Thread Dag-Erling Smørgrav
"M. Warner Losh" <[EMAIL PROTECTED]> writes: > rm doesn't have to live in the chroot. Consider > chroot /some/path/to/a/chroot rm -rf / > in this case, everything under the /some/path/to/a/chroot would be > removed. However, the rm that's running is outside of the chroot. Wrong, and I'd be

Re: Protection from the dreaded "rm -fr /"

2004-10-03 Thread Thomas Sparrevohn
A simple and pragmatic solution is to use alias in what ever shell you are using e.g. alias rm to rm -i. There used to be a simple "delete" command or script that basically moved all files into a ".deleted" directory insted of actually deleting the files - From a practical point of view it does

Re: Protection from the dreaded "rm -fr /"

2004-10-03 Thread Dmitry Morozovsky
On Sun, 3 Oct 2004, M. Warner Losh wrote: [snip] MWL> rm doesn't have to live in the chroot. Consider MWL>chroot /some/path/to/a/chroot rm -rf / MWL> in this case, everything under the /some/path/to/a/chroot would be MWL> removed. However, the rm that's running is outside of the chroot. No

Re: Protection from the dreaded "rm -fr /"

2004-10-03 Thread Greg Shenaut
The "rm -fr /" is not dreaded. What is dreaded is running that command and other equally dangerous "rm" variants by mistake. Usually, the mistake comes from not paying attention to what you are typing or where you are in the directory hierarchy (for example, "rm -rf *" is probably much more likely

Re: Protection from the dreaded "rm -fr /"

2004-10-03 Thread M. Warner Losh
In message: <[EMAIL PROTECTED]> Tillman Hodgson <[EMAIL PROTECTED]> writes: : On Sat, Oct 02, 2004 at 07:29:51PM -0600, M. Warner Losh wrote: : > In message: <[EMAIL PROTECTED]> : > Tillman Hodgson <[EMAIL PROTECTED]> writes: : > : It'll never work, though, that's the thing.

Re: Protection from the dreaded "rm -fr /"

2004-10-03 Thread Mike Meyer
In <[EMAIL PROTECTED]>, Ryan Sommers <[EMAIL PROTECTED]> typed: > Edwin Groothuis wrote: > >On Sat, Oct 02, 2004 at 11:19:28AM +0300, Giorgos Keramidas wrote: > >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 t

Re: Protection from the dreaded "rm -fr /"

2004-10-03 Thread Mike Meyer
In <[EMAIL PROTECTED]>, Giorgos Keramidas <[EMAIL PROTECTED]> typed: > 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,

Re: Protection from the dreaded "rm -fr /"

2004-10-03 Thread Chris Howells
On Saturday 02 October 2004 09:51, Giorgos Keramidas wrote: > Yes, so?  Does it mean we should always point guns at our feet and hope > that we don't accidentally pull the trigger because some unlucky event > made us jump a bit up? It just seems pointless to prevent yourself shooting yourself with

Re: Protection from the dreaded "rm -fr /"

2004-10-03 Thread Sam Lawrance
The problem can be solved by installing only slow disks and mounting filesystems in sync mode. As it takes so long to delete files in this environment, you have plenty of time to hit ctrl-c when you realise what you've done. ;) ___ [EMAIL PROTECTED] ma

Re: Protection from the dreaded "rm -fr /"

2004-10-02 Thread David Schultz
On Sat, Oct 02, 2004, M. Warner Losh wrote: > In message: <[EMAIL PROTECTED]> > Giorgos Keramidas <[EMAIL PROTECTED]> writes: > : On 2004-10-02 19:29, "M. Warner Losh" <[EMAIL PROTECTED]> wrote: > : > In message: <[EMAIL PROTECTED]> > : > Tillman Hodgson <[EMAIL PROTECTED]>

Re: Protection from the dreaded "rm -fr /"

2004-10-02 Thread Tillman Hodgson
On Sat, Oct 02, 2004 at 08:14:18PM -0600, Doug Russell wrote: > > On Sat, 2 Oct 2004, Thomas David Rivers wrote: > > > If I'm remembering correctly - the historical way to > > do this is to alias the "rm" command to something that > > else that checks the arguments and complains appropriately

Re: Protection from the dreaded "rm -fr /"

2004-10-02 Thread Tillman Hodgson
On Sat, Oct 02, 2004 at 07:29:51PM -0600, M. Warner Losh wrote: > In message: <[EMAIL PROTECTED]> > Tillman Hodgson <[EMAIL PROTECTED]> writes: > : It'll never work, though, that's the thing. At some point it'll rm > : something it itself needs and error out. There isn't a way to use `r

Re: Protection from the dreaded "rm -fr /"

2004-10-02 Thread Doug Russell
On Sat, 2 Oct 2004, Thomas David Rivers wrote: > If I'm remembering correctly - the historical way to > do this is to alias the "rm" command to something that > else that checks the arguments and complains appropriately > (and then executes /bin/rm.) Typically with just a shell This would

Re: Protection from the dreaded "rm -fr /"

2004-10-02 Thread M. Warner Losh
In message: <[EMAIL PROTECTED]> Giorgos Keramidas <[EMAIL PROTECTED]> writes: : On 2004-10-02 19:29, "M. Warner Losh" <[EMAIL PROTECTED]> wrote: : > In message: <[EMAIL PROTECTED]> : > Tillman Hodgson <[EMAIL PROTECTED]> writes: : > : It'll never work, though, that's the thi

Re: Protection from the dreaded "rm -fr /"

2004-10-02 Thread Thomas David Rivers
Everyone, If I'm remembering correctly - the historical way to do this is to alias the "rm" command to something that else that checks the arguments and complains appropriately (and then executes /bin/rm.) Typically with just a shell alias. That keeps you from accidently doing something.

Re: Protection from the dreaded "rm -fr /"

2004-10-02 Thread Giorgos Keramidas
On 2004-10-02 19:29, "M. Warner Losh" <[EMAIL PROTECTED]> wrote: > In message: <[EMAIL PROTECTED]> > Tillman Hodgson <[EMAIL PROTECTED]> writes: > : It'll never work, though, that's the thing. At some point it'll rm > : something it itself needs and error out. There isn't a way to use `

Re: Protection from the dreaded "rm -fr /"

2004-10-02 Thread M. Warner Losh
In message: <[EMAIL PROTECTED]> Tillman Hodgson <[EMAIL PROTECTED]> writes: : On Sat, Oct 02, 2004 at 10:42:16AM -0500, Sean Farley wrote: : > Why not default on? root will not run 'rm -rf /' on purpose very often. : > Once will be enough. :) Also, when and why would someone want to

Re: Protection from the dreaded "rm -fr /"

2004-10-02 Thread M. Warner Losh
In message: <[EMAIL PROTECTED]> Tillman Hodgson <[EMAIL PROTECTED]> writes: : It'll never work, though, that's the thing. At some point it'll rm : something it itself needs and error out. There isn't a way to use `rm : -rf /` that /doesn't/ result in foot-shooting. No. You are wrong.

Re: Protection from the dreaded "rm -fr /"

2004-10-02 Thread M. Warner Losh
In message: <[EMAIL PROTECTED]> Sean Farley <[EMAIL PROTECTED]> writes: : Why not default on? root will not run 'rm -rf /' on purpose very often. : Once will be enough. :) Also, when and why would someone want to do : this? Please consider chroots. Root many want to do this in a ch

Re: Protection from the dreaded "rm -fr /"

2004-10-02 Thread David Schultz
On Sun, Oct 03, 2004, Giorgos Keramidas wrote: > On 2004-10-02 17:22, Garance A Drosihn <[EMAIL PROTECTED]> wrote: > > At 8:57 PM +0300 10/2/04, Giorgos Keramidas wrote: > > >On 2004-10-02 21:23, Lee Harr <[EMAIL PROTECTED]> wrote: > > >> How about: > > >> chflags sunlnk / > > >> ? > > > > > >Setti

Re: Protection from the dreaded "rm -fr /"

2004-10-02 Thread Giorgos Keramidas
On 2004-10-02 17:22, Garance A Drosihn <[EMAIL PROTECTED]> wrote: > At 8:57 PM +0300 10/2/04, Giorgos Keramidas wrote: > >On 2004-10-02 21:23, Lee Harr <[EMAIL PROTECTED]> wrote: > >> How about: > >> chflags sunlnk / > >> ? > > > >Setting sunlink on / will only protect the / directory, not its > >d

Re: Protection from the dreaded "rm -fr /"

2004-10-02 Thread Giorgos Keramidas
On 2004-10-02 21:16, Michael Reifenberger <[EMAIL PROTECTED]> wrote: >> Exactly. Who would expect `rm -rf /` to actually succeed? It's not >> only dangerous, it doesn't work in a useful way ;-) >> >> If one is thinking about `rm -rf /`, `newfs` is probably the right >> answer. > > newfs only works

Re: Protection from the dreaded "rm -fr /"

2004-10-02 Thread soralx
> > 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' req

Re: Protection from the dreaded "rm -fr /"

2004-10-02 Thread Ceri Davies
On Sat, Oct 02, 2004 at 05:22:50PM -0400, Garance A Drosihn wrote: > At 8:57 PM +0300 10/2/04, Giorgos Keramidas wrote: > >On 2004-10-02 21:23, Lee Harr <[EMAIL PROTECTED]> wrote: > > > > John Beck, who works for Sun, has posted an entry in his blog > > > > yesterday about "rm -fr /" protection, wh

Re: Protection from the dreaded "rm -fr /"

2004-10-02 Thread Garance A Drosihn
At 8:57 PM +0300 10/2/04, Giorgos Keramidas wrote: On 2004-10-02 21:23, Lee Harr <[EMAIL PROTECTED]> 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#r

Re: Protection from the dreaded "rm -fr /"

2004-10-02 Thread Tillman Hodgson
On Sat, Oct 02, 2004 at 09:16:08PM +0200, Michael Reifenberger wrote: > On Sat, 2 Oct 2004, Giorgos Keramidas wrote: > ... > >>Exactly. Who would expect `rm -rf /` to actually succeed? It's not only > >>dangerous, it doesn't work in a useful way ;-) > >> > >>If one is thinking about `rm -rf /`, `ne

Re: Protection from the dreaded "rm -fr /"

2004-10-02 Thread Michael Reifenberger
On Sat, 2 Oct 2004, David Schultz wrote: Date: Sat, 2 Oct 2004 16:12:11 -0400 From: David Schultz <[EMAIL PROTECTED]> To: Michael Reifenberger <[EMAIL PROTECTED]> Cc: [EMAIL PROTECTED] Subject: Re: Protection from the dreaded "rm -fr /" On Sat, Oct 02, 2004, Michael Reifenb

Re: Protection from the dreaded "rm -fr /"

2004-10-02 Thread David Schultz
On Sat, Oct 02, 2004, Michael Reifenberger wrote: > On Sat, 2 Oct 2004, David Schultz wrote: > ... > >Do you also want to be able to swap to the root partition while > >it's mounted? We can bring back that feature, too. But > >personally, I don't see anything wrong with the view that > >operation

Re: Protection from the dreaded "rm -fr /"

2004-10-02 Thread Doug Russell
On Sat, 2 Oct 2004, Giorgos Keramidas wrote: > I see a lot of people don't like the change, even though I made it > default to off and controlled by an environment variable. There's > no reason to keep pushing for it, then. There's significant support for it, too. As long as it can be disabled

Re: Protection from the dreaded "rm -fr /"

2004-10-02 Thread Dmitry Frolov
* Giorgos Keramidas <[EMAIL PROTECTED]> [02.10.2004 16:07]: > On 2004-10-02 11:51, Giorgos Keramidas <[EMAIL PROTECTED]> wrote: > > On 2004-10-02 10:34, Michael Reifenberger <[EMAIL PROTECTED]> wrote: > > > > > > This does only help for the obvious case of '/' but not for the > > > './' and '../'

Re: Protection from the dreaded "rm -fr /"

2004-10-02 Thread Michael Reifenberger
On Sat, 2 Oct 2004, David Schultz wrote: ... Do you also want to be able to swap to the root partition while it's mounted? We can bring back that feature, too. But personally, I don't see anything wrong with the view that operations that are guaranteed to shoot people in the foot should be disall

Re: Protection from the dreaded "rm -fr /"

2004-10-02 Thread Doug Russell
On Sat, 2 Oct 2004, Dimitry Andric wrote: > Of course, your work is commendable, but isn't is much simpler to just > not type commands like that? I mean, "rm -rf /etc" or "rm -rf /bin" > are just as bad, but do you really want to be checking for all > possible `bad' deletions? That way, we'll s

Re: Protection from the dreaded "rm -fr /"

2004-10-02 Thread Michael Reifenberger
On Sat, 2 Oct 2004, Giorgos Keramidas wrote: ... Exactly. Who would expect `rm -rf /` to actually succeed? It's not only dangerous, it doesn't work in a useful way ;-) If one is thinking about `rm -rf /`, `newfs` is probably the right answer. ... newfs only works if the root is not mounted because

Re: Protection from the dreaded "rm -fr /"

2004-10-02 Thread David Schultz
On Sat, Oct 02, 2004, Jacques A. Vidrine wrote: > FWIW, I'm not in favor of adding ad-hoc "features" to handle edge-cases. > ("feature" because this is actually introducing a bug :-) > > I picked this email to which to respond, because I can share my own > stupidity. Case much like the one descri

Re: Protection from the dreaded "rm -fr /"

2004-10-02 Thread David Schultz
On Sat, Oct 02, 2004, Michael Reifenberger wrote: > On Sat, 2 Oct 2004, Giorgos Keramidas wrote: > > >Date: Sat, 2 Oct 2004 11:19:28 +0300 > >From: Giorgos Keramidas <[EMAIL PROTECTED]> > >To: [EMAIL PROTECTED] > >Subject: Protection from the dreaded "rm -

Re: Protection from the dreaded "rm -fr /"

2004-10-02 Thread Doug Russell
On Sat, 2 Oct 2004, Max Laier wrote: > I am not a fan of providing seat belts like this. People concerned about Neither am I. One of the best features of UNIX has always been that you can shoot yourself in the foot if you want to. If someone really wants seatbelts, they must be optional. Late

Re: Protection from the dreaded "rm -fr /"

2004-10-02 Thread Tillman Hodgson
On Sat, Oct 02, 2004 at 08:55:17PM +0300, Giorgos Keramidas wrote: > On 2004-10-02 10:51, Tillman Hodgson <[EMAIL PROTECTED]> wrote: > > If one is thinking about `rm -rf /`, `newfs` is probably the right > > answer. > > And a hell of a lot faster too. Exactly. > This is the *only* reason why I i

Re: Protection from the dreaded "rm -fr /"

2004-10-02 Thread Giorgos Keramidas
On 2004-10-02 21:23, Lee Harr <[EMAIL PROTECTED]> 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 we

Re: Protection from the dreaded "rm -fr /"

2004-10-02 Thread Giorgos Keramidas
On 2004-10-02 10:51, Tillman Hodgson <[EMAIL PROTECTED]> wrote: > On Sat, Oct 02, 2004 at 10:42:16AM -0500, Sean Farley wrote: > > Why not default on? root will not run 'rm -rf /' on purpose very often. > > Once will be enough. :) Also, when and why would someone want to do > > this? > > Exactly

Re: Protection from the dreaded "rm -fr /"

2004-10-02 Thread Giorgos Keramidas
On 2004-10-02 11:46, "Jacques A. Vidrine" <[EMAIL PROTECTED]> wrote: > > Will the next step be to prevent `rm -fr *' iff the current working > directory is '/' ? Please explain your answer. :-) No. The fact * was passed is not visible to the running program. It's probably better to do this in

Re: Protection from the dreaded "rm -fr /"

2004-10-02 Thread Tillman Hodgson
On Sat, Oct 02, 2004 at 04:48:46PM +0200, Dimitry Andric wrote: > Of course, your work is commendable, but isn't is much simpler to just > not type commands like that? I mean, "rm -rf /etc" or "rm -rf /bin" > are just as bad, but do you really want to be checking for all > possible `bad' deletions

Re: Protection from the dreaded "rm -fr /"

2004-10-02 Thread Lee Harr
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: How about: chflags s

Re: Protection from the dreaded "rm -fr /"

2004-10-02 Thread Tillman Hodgson
On Sat, Oct 02, 2004 at 10:42:16AM -0500, Sean Farley wrote: > Why not default on? root will not run 'rm -rf /' on purpose very often. > Once will be enough. :) Also, when and why would someone want to do > this? Exactly. Who would expect `rm -rf /` to actually succeed? It's not only dangerous,

Re: Protection from the dreaded "rm -fr /"

2004-10-02 Thread Jacques A. Vidrine
On Sat, Oct 02, 2004 at 10:43:49PM +1000, Peter Jeremy wrote: > I've had a customer write a cronjob that did almost exactly this. > He managed to 'test' it on all the (redundant) production systems > as well as the test model. We were only called in when he found > that there were some unexpected

Re: Protection from the dreaded "rm -fr /"

2004-10-02 Thread Sam
This is UNIX, not Windows. Agreed -- besides, it's only a matter of time before this and fourteen other -f related flags are incorporated into the gnu rm. Use it if you've got a problem with simple tools that do what you ask them to. Sam ___ [EMAIL PROTE

Re: Protection from the dreaded "rm -fr /"

2004-10-02 Thread Sean Farley
On Sat, 2 Oct 2004, Max Laier wrote: At very least you should consider to error out silently as POSIX requires "-f" to be silent. Other than that you should really look into the standards and what they way about rm and friends. Personally, I would want it to throw an error for the exit, but I do no

Re: Protection from the dreaded "rm -fr /"

2004-10-02 Thread Simon L. Nielsen
On 2004.10.02 16:48:46 +0200, Dimitry Andric wrote: > On 2004-10-02 at 10:19:28 Giorgos Keramidas wrote: > > > His idea was remarkably simple, so I went ahead and wrote this patch for > > rm(1) of FreeBSD: > > Of course, your work is commendable, but isn't is much simpler to just > not type comma

Re: Protection from the dreaded "rm -fr /"

2004-10-02 Thread Dimitry Andric
On 2004-10-02 at 10:19:28 Giorgos Keramidas wrote: > His idea was remarkably simple, so I went ahead and wrote this patch for > rm(1) of FreeBSD: Of course, your work is commendable, but isn't is much simpler to just not type commands like that? I mean, "rm -rf /etc" or "rm -rf /bin" are just as

Re: Protection from the dreaded "rm -fr /"

2004-10-02 Thread Peter Jeremy
On Sat, 2004-Oct-02 11:51:43 +0300, Giorgos Keramidas wrote: >The reason I liked this idea is that root has zillions of other ways to >destroy an entire system, but not many of them are likely to be the >result of mistyping a single character as shown below: > > # rm -fr / home/someuser/* I'

Re: Protection from the dreaded "rm -fr /"

2004-10-02 Thread Max Laier
On Saturday 02 October 2004 13:22, Ceri Davies wrote: > On Sat, Oct 02, 2004 at 11:23:52AM +0200, Max Laier wrote: > > [ Sorry to be so negative ... ] > > > > At very least you should consider to error out silently as POSIX requires > > "-f" to be silent. Other than that you should really look into

Re: Protection from the dreaded "rm -fr /"

2004-10-02 Thread Ceri Davies
On Sat, Oct 02, 2004 at 11:51:43AM +0300, Giorgos Keramidas wrote: > Adding protection that prevents foot-shooting is not something without > precedent to FreeBSD either: > http://www.freebsd.org/cgi/cvsweb.cgi/src/usr.sbin/boot0cfg/boot0cfg.c.diff?r1=1.13&r2=1.14 Is that the correct reference?

Re: Protection from the dreaded "rm -fr /"

2004-10-02 Thread Ceri Davies
On Sat, Oct 02, 2004 at 11:23:52AM +0200, Max Laier wrote: > [ Sorry to be so negative ... ] > > At very least you should consider to error out silently as POSIX requires "-f" > to be silent. Other than that you should really look into the standards and > what they way about rm and friends. Are

Re: Protection from the dreaded "rm -fr /"

2004-10-02 Thread Greg Black
On 2004-10-02, Giorgos Keramidas wrote: > I liked what Max Laier proposed though, about making this tunable and > defaulting to off. See below for the behavior of what I've come up with: > > On 2004-10-02 11:23, Max Laier <[EMAIL PROTECTED]> wrote: > > [ Sorry to be so negative ... ] > > > > At

Re: Protection from the dreaded "rm -fr /"

2004-10-02 Thread Giorgos Keramidas
On 2004-10-02 03:52, Ryan Sommers <[EMAIL PROTECTED]> wrote: > On Sat, Oct 02, 2004 at 11:19:28AM +0300, Giorgos Keramidas wrote: > >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

Re: Protection from the dreaded "rm -fr /"

2004-10-02 Thread Max Laier
[ Sorry to be so negative ... ] At very least you should consider to error out silently as POSIX requires "-f" to be silent. Other than that you should really look into the standards and what they way about rm and friends. I am not a fan of providing seat belts like this. People concerned about

Re: Protection from the dreaded "rm -fr /"

2004-10-02 Thread Giorgos Keramidas
On 2004-10-02 11:51, Giorgos Keramidas <[EMAIL PROTECTED]> wrote: > On 2004-10-02 10:34, Michael Reifenberger <[EMAIL PROTECTED]> wrote: > > > > This does only help for the obvious case of '/' but not for the > > './' and '../' or '../../' ... accidents. > > Hmm, indeed. This can be fixed, but it

Re: Protection from the dreaded "rm -fr /"

2004-10-02 Thread Giorgos Keramidas
On 2004-10-02 18:33, Edwin Groothuis <[EMAIL PROTECTED]> 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

Re: Protection from the dreaded "rm -fr /"

2004-10-02 Thread Ryan Sommers
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 remark

Re: Protection from the dreaded "rm -fr /"

2004-10-02 Thread Giorgos Keramidas
On 2004-10-02 10:34, Michael Reifenberger <[EMAIL PROTECTED]> wrote: > On Sat, 2 Oct 2004, Giorgos Keramidas wrote: > >Date: Sat, 2 Oct 2004 11:19:28 +0300 > >From: Giorgos Keramidas <[EMAIL PROTECTED]> > >To: [EMAIL PROTECTED] > >Subject: Protection from

Re: Protection from the dreaded "rm -fr /"

2004-10-02 Thread Giorgos Keramidas
On 2004-10-02 11:19, Giorgos Keramidas <[EMAIL PROTECTED]> 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 Here's a simpler diff, which I wrote af

Re: Protection from the dreaded "rm -fr /"

2004-10-02 Thread Michael Reifenberger
On Sat, 2 Oct 2004, Giorgos Keramidas wrote: Date: Sat, 2 Oct 2004 11:19:28 +0300 From: Giorgos Keramidas <[EMAIL PROTECTED]> To: [EMAIL PROTECTED] Subject: Protection from the dreaded "rm -fr /" John Beck, who works for Sun, has posted an entry in his blog yesterday about "

Re: Protection from the dreaded "rm -fr /"

2004-10-02 Thread Edwin Groothuis
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

Protection from the dreaded "rm -fr /"

2004-10-02 Thread Giorgos Keramidas
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: %%% Index: rm.c ===