On Sat, Jun 10, 2000 at 08:31:56PM -0400, Jacob I. Stowell wrote:
> hello
>
> i am a new debian user and i just learned a hard lesson. I guess it is
> a bad idea to issue the following command:
>
> rm -R /usr/
Reminds me of the time I did an "rm -rf * /" as root.
Here's what happened:
- I blew away my root partition.
- I blew away the mounted disk I was trying to clear.
I was doing some partition shuffling, so I'd mounted the rest of my
partitions read-only. I was trying to restore a backup and had botched
the process, so the partition I had mounted rw was the one I was trying
to delete.
Because I was running admin mode, I had booted off a boot image.
The net result was that I didn't actually do any damage to my system --
the boot image was still safe on disk, nothing but the one partition I
was trying to kill was writable. I *did* have to reboot to get a useful
system (interesting moving around when all you've got is your current
shell process running).
The lesson: if you're going to do something potentially dangerous to
your system, minimize the potential for danger first.
I personally vote *against* aliasing 'rm' to 'rm -i' or similar. It's
far too easy to fall into bad habits, like counting on the fact that
'rm' is in fact aliased, or typing '-f' as a matter of course, or
running as root. None of which will do you any good, and all of which
become difficult to unlearn.
Rather, I do one of the following:
- Sit on my hands for 10 seconds before issuing any 'rm' as root.
Literally.
- Do the following:
$ su -c 'chown -R <tree> karsten.karsten'
$ rm -rf <tree>
...with both commands being issued from my user account.
The first changes ownership of the directory tree I want to nuke to some
unprivileged user. The second nukes the tree. I get two chances to see
if I'm doing something stupid. If I make a typo the first time, I've
got a mild PITA to restore ownerships. If I make a typo the second
time, chances are I can't do anything.
--
Karsten M. Self <kmself@ix.netcom.com> http://www.netcom.com/~kmself
Evangelist, Opensales, Inc. http://www.opensales.org
What part of "Gestalt" don't you understand? Debian GNU/Linux rocks!
http://gestalt-system.sourceforge.net/ K5: http://www.kuro5hin.org
GPG fingerprint: F932 8B25 5FDD 2528 D595 DC61 3847 889F 55F2 B9B0
Attachment:
pgpegiRB5B6j1.pgp
Description: PGP signature