35

What is the most damage (of whatever kind) that you have ever caused with a single mistaken/mistyped/misguided command line? I deleted a production system database by mistake a while back, for example, but I was lucky (i.e. backed-up) and there was no permanent data loss, lost money, property damage etc.

Most importantly (for votes), what do you do to make sure it will not ever happen again?

Michael Hampton
  • 247,473
  • 9
    Since this is a poll, it should be CW – Eddie May 06 '09 at 02:00
  • Then why aren't polls CW by default? – Luke May 06 '09 at 04:19
  • 4
    How should they know it's a poll progmatically? – Mikeage May 06 '09 at 08:14
  • Nobody's got enough rep to change it yet :) – Gareth May 06 '09 at 12:25
  • 1
    If the mechanism is the same as SO's, even if you can edit a question, you can't change it to CW. Only the OP or a moderator can do that. – chaos May 06 '09 at 14:09
  • Nobody but the OP and the staff moderators can edit the question yet, since the highest rep user is still more than a day's worth of rep below 2000. After that, the edit by several distinct users will apply. But the 30 answers rule should still apply.... – RBerteig May 07 '09 at 23:01
  • 9
    Good idea - post your most destructive mistake publicly on the internet for all future employers to see! :) – Sam Schutte May 13 '09 at 19:29

81 Answers81

46

In SQL server, on a production system:

update customer set password = '' <enter>

The most recent backup was like a week old.

To mitigate this, I now usually write a select statement first to make sure I've got the where clause correct, then go back and edit it to insert the set clause and change the statement to update.

Greg Hewgill
  • 6,929
  • 3
  • 30
  • 26
  • 11
    Ouch. Another option would be 'BEGIN TRANSACTION'; it's nice to know you can roll back. :) – Murali Suriar May 06 '09 at 09:35
  • 5
    Combination of the two, select count(*) to see how many I think I'll update, and then update in transaction to do the update. If the counts match commit, if not rollback and figure out why. Of course, I don't do that for "simple" updates, and those are always the ones that screw you. :-) – WaldenL May 06 '09 at 12:47
  • Guilty, I've done that myself :( – Jim OHalloran May 13 '09 at 23:33
  • 8
    Be careful with BEGIN TRANSACTION on a live system (or a test system being used by others too) - make sure you COMMIT or ROLLBACK soon or you may end up deadlocking other processes waiting for locks on resources your transaction holds locks on. – David Spillett Jun 07 '09 at 20:13
  • On some systems, you can make ; be the statement completion identifier, instead of – J. Polfer Jun 25 '09 at 17:18
  • IMO some sort of this is common to most IT people :) This is where the power turns against you. Worse example: a delete statement without a where... – Halil Özgür Dec 18 '10 at 11:41
37

Biggest mistake? Thinking I had set two variables when I had not. So rm -rf $VARIABLE/$VARIABLE2 became rm -rf /. FreeBSD has recently updated their rm tool so that rm -rf / is not possible anymore precisely because of this mistake!

X-Istence
  • 762
  • 4
    I would like to point out, re-reading my sentence it sounds like I was the reason for changing the way rm worked, this is not the case. Apparently people were using rm in scripts and the same thing happened and they wanted to add a fail-safe. – X-Istence May 06 '09 at 07:42
  • 3
    i withdraw my vote then :) – Colin Pickard May 19 '09 at 20:33
  • I once saw a guy do rm -rf / usr/local/junk...I saw it, but not in time to keep him from hitting enter. – Satanicpuppy Mar 17 '11 at 14:37
  • What about "rm -rf /*" instead of "rm -rf /" ? I don't have idea how it looks on BSD's now, but should work ;) – Ryszard Stawiarski Mar 28 '11 at 05:01
26

Omitting the -r from a shutdown command. On a remote server. On the other side of the country. With no IT staff in the remote office.

We've all done it, it's almost like a rite of passage at this stage.

26
shutdown -h now 

meant for the local workstation, but typed it while logged via ssh on production server. Since then I always have hostname in my $PS1.

vartec
  • 6,237
  • At least you probably wouldn't lose any data... – Zifre May 06 '09 at 21:10
  • True, but that was really long time ago, IPMI nor KVMoIP where not yet popular. We had to get hold of technician to actually go there and flip the switch. – vartec May 07 '09 at 07:48
  • 4
    Check out molly-guard (http://packages.debian.org/search?keywords=molly-guard) – David Holm May 29 '09 at 20:14
  • Even on local workstations, I always use "+1" just in case. – msanford Jun 07 '09 at 19:40
  • This is exactly why I put the host in my prompt! – staticsan Jun 11 '09 at 02:59
  • 3
    I used to put the hostname in the prompt, but now I have patched the shutdown (and related - halt et al) commands to prompt me to enter the current machines name before it will execute the command.

    That gives me the extra step necessary to realise that I just shutdown the wrong server. Problem is, once I implemented that patch, I never did it again - but its saved a few of my colleagues tho :)

    – Moo Jun 11 '09 at 15:33
  • I did the reverse, I was going to shutdown a remote machine, but the connection had been lost or timed out in that window, so my own machine was halted instead. Not too bad, but very frustrating :) – Zitrax Jun 11 '09 at 22:33
25

On a VMS system, I had been using the ASSIGN DCL command to assign logical names, and I wanted to RECALL a previous ASSIGN command line. Now, in VMS, you only typed as many characters of a command to make it unambiguous. So I intended to type

REC ASS

but I accidentally typed

REQ ASS

instead. REQ was sufficiently unambigous for the REQUEST command, which broadcasts the argument to everyone with operator privs (which was everyone in IT). So the entire department received my broadcast message which was simply "ASS".

24

On a Solaris system: "killall dataLoader".

'dataLoader' was an app I was working on. On Linux, killall works like pkill. It sends a signal to processes that match a string given as the argument. On Solaris, killall trys to kill everything on the system the current user can kill. I was root.

kbyrd
  • 3,722
16

Once, many many moons ago, I needed to find a particular executable but couldn't remember the complete name of it (but could remember a few of the letters). So I figured I'd check the /usr/bin directory with something like this

rm /usr/bin/i*g*

Strange. Nothing returned. Figuring I just had misremembered the second letter, I tried again with

rm /usr/bin/i*

Again, nothing. After doing the same with /usr/local/bin, /usr/sbin, and anything else I figured it might be in, I realized I'd been mistyping the 'ls' command.

Don't quite know where the brainfart came from, but it's definitely not a mistake I ever made again.

goldPseudo
  • 1,106
16

Trying to change ownership of everything in a directory, including dot files, with:

chown -R user * .*

Guess what that does?

chaos
  • 7,493
  • 2
    @chaos: It does not remove .. and never has and never will. You are simply mistaken. Please cite a single unix implementation that does have this behavior (which I have never seen and which is documented to not be the behavior of even super-antique unixes like 7th edition unix). – chris Jun 25 '09 at 15:44
  • @chris: Yeah, you're right. Apparently I remembered what happened as slightly more catastrophic than it was. Possibly it was all the screaming. Edit made to reflect what I think must have gone on. – chaos Jun 25 '09 at 16:30
  • 1
    Would ./.* prevent this, or would it still propagate back up the directory tree via ./../? – TJ L Jun 25 '09 at 17:41
  • 1
    ./.* doesn't help, no. – chaos Jun 25 '09 at 17:42
  • This is one of the things zsh does right: globbing never matches '.' or '..' – Phil P Sep 28 '10 at 23:35