I've been using the command line for quite a while, and consider myself an intermediate UNIX user, but that doesn't mean I'm immune to carelessness. While I've finally genetically modified my brain to NEVER use asterisk in combination with the "rm" command, there was one command I performed absent-mindedly last week that wreaked havoc, and that I had never thought about as possibly being as destructive as it was. Can I warn you all about it?
I was working on a networking consultancy gig when I noticed sendmail was acting up because the root directory had become group writable again. So I reached over to quickly fix it, and typed:
> sudo chmod 700 /
I should have typed chmod 750, but I didn't. Now, you long time UNIX users will immediately see the horror of what I'd done, but I didn't get it, at least until all sorts of processes began shutting down. Then, it dawned on me: I had basically locked myself out of doing anything.... anything at all on my computer! Nowhere in any CLI tutorials had I been warned of this, and it seemed so innocuous. I wasn't "removing" anything, just reconfiguring. The trouble is, that I couldn't use the sudo command to undo the damage because sudo is a program located in the /sbin directory, and I could no longer access the /sbin directory because I was locked out from any directory past root... i.e., the entire machine.
There may have been some expert way to get out of this, but I sure couldn't think of any. (And I would love to see them listed here). So I restarted from an OS 9 CD, copied all the configuration and User files I could from my machine, reformatted my drive (might as well), and started over.
That's my warning. BE CAREFUL OUT THERE!. Never type sudo with anything less than FULL attention.