My 10 UNIX Command Line Mistakes

by Vivek Gite · 145 comments

Anyone who has never made a mistake has never tried anything new. -- Albert Einstein.

Here are a few mistakes that I made while working at UNIX prompt. Some mistakes caused me a good amount of downtime. Most of these mistakes are from my early days as a UNIX admin.

userdel Command

The file /etc/deluser.conf was configured to remove the home directory (it was done by previous sys admin and it was my first day at work) and mail spool of the user to be removed. I just wanted to remove the user account and I end up deleting everything (note -r was activated via deluser.conf):
userdel foo

Rebooted Solaris Box

On Linux killall command kill processes by name (killall httpd). On Solaris it kill all active processes. As root I killed all process, this was our main Oracle db box:
killall process-name

Destroyed named.conf

I wanted to append a new zone to /var/named/chroot/etc/named.conf file., but end up running:
./mkzone example.com > /var/named/chroot/etc/named.conf

Destroyed Working Backups with Tar and Rsync (personal backups)

I had only one backup copy of my QT project and I just wanted to get a directory called functions. I end up deleting entire backup (note -c switch instead of -x):
cd /mnt/bacupusbharddisk
tar -zcvf project.tar.gz functions

I had no backup. Similarly I end up running rsync command and deleted all new files by overwriting files from backup set (now I’ve switched to rsnapshot)
rsync -av -delete /dest /src
Again, I had no backup.

Deleted Apache DocumentRoot

I had sym links for my web server docroot (/home/httpd/http was symlinked to /www). I forgot about symlink issue. To save disk space, I ran rm -rf on http directory. Luckily, I had full working backup set.

Accidentally Changed Hostname and Triggered False Alarm

Accidentally changed the current hostname (I wanted to see current hostname settings) for one of our cluster node. Within minutes I received an alert message on both mobile and email.
hostname foo.example.com

Public Network Interface Shutdown

I wanted to shutdown VPN interface eth0, but ended up shutting down eth1 while I was logged in via SSH:
ifconfig eth1 down

Firewall Lockdown

I made changes to sshd_config and changed the ssh port number from 22 to 1022, but failed to update firewall rules. After a quick kernel upgrade, I had rebooted the box. I had to call remote data center tech to reset firewall settings. (now I use firewall reset script to avoid lockdowns).

Typing UNIX Commands on Wrong Box

I wanted to shutdown my local Fedora desktop system, but I issued halt on remote server (I was logged into remote box via SSH):
halt
service httpd stop

Wrong CNAME DNS Entry

Created a wrong DNS CNAME entry in example.com zone file. The end result - a few visitors went to /dev/null:
echo 'foo 86400 IN CNAME lb0.example.com' >> example.com && rndc reload

Failed To Update Postfix RBL Configuration

In 2006 ORDB went out of operation. But, I failed to update my Postfix RBL settings. One day ORDB was re-activated and it was returning every IP address queried as being on its blacklist. The end result was a disaster.

Conclusion

All men make mistakes, but only wise men learn from their mistakes -- Winston Churchill.

From all those mistakes I’ve learnt that:

  1. Backup = ( Full + Removable tapes (or media) + Offline + Offsite + Tested )
  2. The clear choice for preserving all data of UNIX file systems is dump, which is only tool that guaranties recovery under all conditions. (see Torture-testing Backup and Archive Programs paper).
  3. Never use rsync with single backup directory. Create a snapshots using rsync or rsnapshots.
  4. Use CVS to store configuration files.
  5. Wait and read command line again before hitting the dam [Enter] key.
  6. Use your well tested perl / shell scripts and open source configuration management software such as puppet, Cfengine or Chef to configure all servers. This also applies to day today jobs such as creating the users and so on.

Mistakes are the inevitable, so did you made any mistakes that have caused some sort of downtime? Please add them into the comments below.

Featured Articles:

Want to read Linux tips and tricks, but don't have time to check our blog everyday? Subscribe to our daily email newsletter to make sure you don't miss a single tip/tricks. Subscribe to our weekly newsletter here!

{ 145 comments… read them below or add one }

1 Jon 06.21.09 at 2:42 am

My all time favorite mistake was a simple extra space:

cd /usr/lib
ls /tmp/foo/bar

I typed
rm -rf /tmp/foo/bar/ *
instead of
rm -rf /tmp/foo/bar/*
The system doesn’t run very will without all of it’s libraries……

2 nels 06.21.09 at 7:32 am

rm -rf /tmp
I didn’t think it would hose me too much, but on a F10 box it was important……

3 firmit 06.21.09 at 9:00 am

Some classics here :)

4 georgesdev 06.21.09 at 9:15 am

never type anything such as:
rm -rf /usr/tmp/whatever
maybe you are going to type enter by mistake before the end of the line. You would then for example erase all your disk starting on /.

if you want to use -rf option, add it at the end on the line:
rm /usr/tmp/whatever -rf
and even this way, read your line twice before adding -rf

5 3ToKoJ 06.21.09 at 9:26 am

public network interface shutdown … done
typing unix command on wrong box … done
Delete apache DocumentRoot … done
Firewall lockdone … done with a NAT rule redirecting the configuration interface of the firewall to another box, serial connection saved me

I can add, being trapped by aptitude keeping tracks of previously planned — but not executed — actions, like “remove slapd from the master directory server”

6 UnixEagle 06.21.09 at 11:03 am

Rebooted the wrong box
While adding alias to main network interface I ended up changing the main IP address, the system froze right away and I had to call for a reboot
Instead of appending text to Apache config file, I overwritten it’s contents
Firewall lockdown while changing the ssh port
Wrongfully run a script contained recursive chmod and chown as root on / caused me a downtime of about 12 hours and a complete re-install

Some mistakes are really silly, and when they happen, you don’t believe your self you did that, but every mistake, regardless of it’s silliness, should be a learned lesson.
If you did a trivial mistake, you should not just overlook it, you have to think of the reasons that made you did it, like: you didn’t have much sleep or your mind was confused about personal life or …..etc.

I like Einstein’s quote, you really have to do mistakes to learn.

7 smaramba 06.21.09 at 11:31 am

typing unix command on wrong box and firewall lockdown are all time classics: been there, done that.
but for me the absolute worst, on linux, was checking a mounted filesystem on a production server…

fsck /dev/sda2

the root filesystem was rendered unreadable. system down. dead. users really pissed off.
fortunately there was a full backup and the machine rebooted within an hour.

8 od 06.21.09 at 12:50 pm

“Typing UNIX Commands on Wrong Box”

Yea, I did that one too. Wanted to shut down my own vm but I issued init 0 on a remote server which I accessed via ssh. And oh yes, it was the production server.

9 Adi 06.21.09 at 10:24 pm

tar -czvf /path/to/file file_archive.tgz
instead of
tar -czvf file_archive.tgz /path/to/file
I ended up destroying that file and had no backup as this command was intended to provide the first backup – it was on the DHCP Linux production server and the file wad dhcpd.conf!

10 sims 06.22.09 at 2:23 am

Funny thing, I don’t remember typing typing in the wrong console. I think that’s because I usually have the hostname right there. Fortunately, I don’t do the same things over and over again very much. Which means I don’t remember command syntax for all but most used commands.

Locking myself out while configuring the firewall – done – more than once. It wasn’t really a CLI mistake though. Just being a n00b.

georgesdev, good one. I usually:

ls -a /path/to/files
to double check the contents
then up arrowkey homekey hit del a few times and type rm. I always get nervous with rm sitting at the prompt. I’ll have to remember that -rf at the end of the line.

I always make mistakes making links. I can never remember the syntax. :/

Here’s to less CLI mistakes… (beer)

11 Grant D. Vallance 06.22.09 at 7:56 am

A couple of days ago I typed and executed (as root): rm -rf /* on my home development server. Not good. Thankfully, the server at the time had nothing important on it, which is why I had no backups …

I am still not sure *why* I did when I have read about all the warnings about using this command. (A dyslexic moment with the syntax?)

Ah well, a good lesson learned. At least it was not the disaster it could of been. I shall be *very* paranoid about this command in the future.

12 Joren 06.22.09 at 9:30 am

I wanted to remove the subfolder etc from the /usr/local/matlab/ directory. So I accidentally added the ‘/’ symbol in a force of habit when going to the /etc folder and I typed from the /usr/local/matlab directory:

sudo rm /etc

instead of

sudo rm etc

Without the entire /etc folder the computer didn't work anymore (which was to be expected ofcourse) and I ended up reinstalling my computer.

13 Ramaswamy 06.22.09 at 10:47 am

Deleted the files
I used place some files in /tmp/rama and some conf files at /home//httpd/conf file
I used to swap between these two directories by “cd -”
Executed the command rm -fr ./*
supposed to remove the files at /tmp/rama/*, but ended up by removing the file at /home//httpd/conf/*, with out any backup

conclusion: check the directory where the rm command removing files of which directory

14 Robsteranium 06.22.09 at 11:05 am

Aza Rashkin explains how habituation can lead to stupid errors – confirming “yes I’m sure/ overwrite file etc” automatically without realising it. Perhaps rm and the > command need an undo/ built-in backup…

15 Ulver 06.22.09 at 2:06 pm

rm -rf /dev/{null,zero} $HOME/dev/

instead of

cp -rf /dev/{null,zero} $HOME/dev/{null,zero}

…live cd and mknod savemes

echo > somefileWithManyCodeLines.pl

instead

echo >> somefileWithManyCodeLines.pl

the x-term history saves me !! (preveusly i dump the content of the file using cat)

so doesn’t care what term uses…set the history at the max.

and…. my prefered (many years ago happens me ….could be an excelent way to …really delete & hide information)

dd if=/dev/urandom of=/dev/withManyData count=1024 bs=1024

instead of

dd if=/dev/zero of=/dev/withManyData count=1 bs=512

the last one i callit “dd unleashed” ….

16 Ulver 06.22.09 at 2:08 pm

i forget it….i the last command i haven’t way to rollback only reinstalling

17 Andrea Ratto 06.22.09 at 5:36 pm

I did a rm -r /usr on my two-years-old gentoo installation. Ctrl-C after one second, most of /usr/bin removed. Running ubuntu since then.

18 RudyD 06.22.09 at 11:32 pm

Sure there were.
First thing to take an ocassional backup before any modifications.
And be careful with tnf testing of scripts with redirections to important commands with absolute path to the binary. In case. somehow I have found the mail binary in a same version server.

Other nice thing to remember. Do wait for password prompt. Especially when someone around you.
Sometimes there are a few seconds to wait and not to type clean readable characters to the console.

19 Nate 06.23.09 at 12:16 am

My worst mistake was when I started using Ubuntu and changing abruptly (but willingly) from Windows to Linux. I accidentally deleted the entire filesystem with a command. No backups but it was a clean install.

20 Yonitg 06.23.09 at 8:06 am

Great post !
I did my share of system mishaps,
killing servers in production, etc.
the most emberassing one was sending 70K users the wrong message.
or beter yet, telling the CEO we have a major crysis, gathering up many people to solve it, and finding that it is nothing at all while all the management is standing in my cube.

21 Serge 06.23.09 at 3:45 pm

or chown all the hidden file in a website directory by ” chown user.group .* ” end up changing owner on all the websites .. (one directory up)

one should use :
chown user.group .??*

good job ;-)

22 Derrick 06.23.09 at 4:10 pm

While adding a user, I attempted to specify the home directory. The directory did not exist yet, so I used the “m” option to create the directory as the user was being created.

But, I left off the name of the home directory that I wanted to create when I typed:

# useradd -s /bin/false -d /export/home -m new_user

I designated the home directory of the new user as /export/home instead of /export/home/new_user.

I ended up wiping out all the other users’ home directories on that server that were also located in /export/home!

I broke out in a cold sweat.

Thank goodness I was able to replace those directories from a backup.

*Whew*

23 Solaris 06.23.09 at 8:37 pm

Firewall lock out: done.
Command on wrong server: done.

And the worst: update and upgrade while some important applications were running, of
course on a production server.. as someone mentioned the system doesn’t run very well
without all of its original libraries :)

24 niskotink0 06.24.09 at 11:14 am

hi.. )
My biggest error, with IPFW on FreeBSD system..
i’m turn on it in kernel:
options IPFIREWALL
and forget ..
options IPFIREWALL_DEFAULT_TO_ACCEPT
reboot.. and ..ups )))

25 Valqk 06.26.09 at 3:51 pm

This is how I protect myself http://blog.valqk.com/archives/Protect-yourself-from-accidentally-halting-a-server.-22.html” rel=”nofollow”>from making wrong halt:

in short I use molly-guard

26 Valqk 06.26.09 at 4:03 pm

Rebooted/halted wrong severs – done. (posted link how to protect from this on linux)
stop wrong interface, firewall lockup – done.
some fun examples.
wanted to delete all hidden files in users home.
rm -fr .* :-D guess if that match . ..? :)
and the nasties thing I did recently is to run reiserfschk on a lvm device! ROLF! Thanks got it was on a testing setup server… neither reiser checked ok neither lvm worked after that. :)

27 ddn 06.26.09 at 10:18 pm

Have done /sbin/init 1 instead of /sbin/init q multiple times.
after siwtching to MS Natural Keyboard.

28 Vivek Gite 06.27.09 at 2:47 am

@everyone:

Thanks for sharing your experience with us.

29 Peko 06.30.09 at 8:46 am

I invented a new one today.

Just assuming that a [-v] option stands for –verbose

Yep, most of the time. But not on a [pkill] command.
[pkill -v myprocess] will kill _any_ process you can kill — except those whose name contains “myprocess”. Ooooops. :-!
(I just wanted pkill to display “verbose” information when killing processes)

Yes, I know. Pretty dumb thing. Lesson learned ?

I would suggest adding another critical rule to your list:
” Read The Fantastic Manual — First” ;-)

30 Maroo 07.01.09 at 4:46 pm

I issued the following command on a BackOffice Trading Box in an attempt to clean out a user’s directory. But issued it in the /local. The command ended up taking out the Application mounted SAN directory and the /local directory.

find . -name “foo.log*” -exec ls -l {} \;|cut -f2 -d “/”|while read NAME; do gzip -c $NAME > $NAME.gz; rm -r $NAME;

done

Took out the server for an entire day.

31 Jai Prakash 07.03.09 at 1:43 pm

Mistake 1:

My Friend tried to see last reboot time and mistakenly executed command “last | reboot” instead of “last | grep reboot”

It made a outage on Production DB server.

Mistake 2:

Another guy, wants to see the FQDN on solaris box and executed “hostname -f”
It changed the hostname name to “-f” and clients faced lot of connectivity issues due to this mistake.
[ hostname -f is used in Linux to see FQDN name but it solaris its usage is different ]

32 Name 07.04.09 at 5:20 pm

Worse thing i’ve done so far, It accidentally dropped a MySQL database containing 13k accounts for a gameserver :D

Luckily i had backups but took a little while to restore,

33 Vince Stevenson 07.06.09 at 6:23 pm

I was dragged into a meeting one day and forgot to secure my Solaris session. A colleague and former friend did this: alias ll=’/usr/sbin/shutdown -g5 -i5 “Bye bye Vince”‘ He must have thought that I was logged into my personal host machine, not the company’s cashcow server. What happens when it all goes wrong. Secure your session… Rgds Vince

34 Bjarne Rasmussen 07.07.09 at 7:56 pm

well, tried many times, the crontab fast typing failure…

crontab -r instead of -e
e for edit
r for remove..

now i always use -l for list before editing…

35 Ian 07.08.09 at 4:15 am

Made a script that automatically removes all files from a directory. Now, rather than making it logically (this was early on) I did it stupidly.

cd /tmp/files
rm ./*

Of course, eventually someone removed /tmp/files..

36 shlomi 07.12.09 at 9:21 am

Hi

On My RHEL 5 sever I create /tmp mount point to my storage and tmpwatch script that run under cron.daily removes files which have not been accessed 12 hours !!!

37 Ville 07.14.09 at 12:17 am

I run a periodic (daily) script on a BSD system to clean out a temp directory for joe (the editor). Anything older than a day gets wiped out. For some historical reason the temp directory sits in /usr/joe-cache rather than in, for instance, /usr/local/joe-cache or /var/joe-cache or /tmp/joe-cache. The first version of the line in the script that does the deleting looked like this:


find /usr/joe-cache/.* -maxdepth 1 -mtime +1 -exec rm {} \;

Good thing the only files in /usr were two symlinks that were neither mission critical nor difficult to recreate as the above also matches “/usr/edit-cache/..” In the above the rather extraneous (joe doesn’t save backup files in sub-directories) “-maxdepth 1″ saved the entire /usr from being wiped out!

The revised version:

find -E /usr/joe-cache/ -regex '/usr/joe-cache/\.?.+$' -maxdepth 1 -mtime +1 -exec rm {} \;

.. which matches files beginning with a dot within “/usr/joe-cache”, but won’t match “/usr/joe-cache/..”

Lesson learned: always test find statements with “-print” before adding “-exec rm {} \;”.

38 brownis 07.18.09 at 6:47 am

sudo chmod 777 * -R
sudo chown user * -R
it is good but not if u r not located at the ~/

i had to reinstall linux, because of the permission mistake !

39 Shrikant 07.22.09 at 2:42 pm

mv /* /tmp (or some where else).

40 Shantanu Oak 07.24.09 at 6:31 am

I remember loosing the .tar files, and now I know why :)
I have never lost important files while using rm -rf
But I do remember copying / creating files at the root when I forgot to add the starting /

41 Shantanu Oak 07.24.09 at 7:12 am

One more mistake that I do remember is copying a directory to another server but without using the recursive option. That copied the files found at the root but the files stored in the sub-folders were not copied.

42 M.S. Babaei 08.01.09 at 3:39 am

once upon a time mkfs is killing me on ext3 partition I want
instead of
mkfs.ext3 /dev/sda1
I did this
mkfs.ext3 /dev/sdb1

I never forget what I lost??

43 Braindead 08.01.09 at 5:57 am

I’ve most of these too :D

My favorite mistake was sitting around waiting for 250 or so gigs of stuff to copy to an nfs share, only to find I forgot to mount the remote share and it all just copied into the directory in /mnt instead. Good thing I had a huge root partition…

44 veeresh 08.07.09 at 6:03 am

i have information abouttttt unix commands

45 Simon B 08.07.09 at 2:47 pm

Whilst a colleague was away from their keyboard I entered :


rm -rf *

… but did not press enter on the last line (as a joke). I expected them to come back and see it as a joke and rofl….back space… The unthinkable happened, the screen went to sleep and they banged the enter key to wake it up a couple of times. We lost 3 days worth of business and some new clients. estimated cost $50,000+

46 ginzero 08.17.09 at 5:10 am

tar cvf /dev/sda1 blah blah…

47 Kevin 08.25.09 at 10:50 am

tar cvf my_dir/* dir.tar
and your write your archive in the first file of the directory …

48 ST 09.17.09 at 10:14 am

I’ve done the wrong server thing. SSH’d into the mailserver to archive some old messages and clear up space.
Mistake #1: I didn’t logoff when I was done, but simply minimized the terminal and kept working
Mistake#2: At the end of the day I opened what I thought was a local terminal and typed:
/sbin/shutdown -h now
thinking I was bringing down my laptop. The angry phone calls started less than a minute later. Thankfully, I just had to run to the server room and press power.

I never thought about using CVS to backup config files. After doing some really dumb things to files in /etc (deleting, stupid edits, etc), I started creating a directory to hold original config files, and renaming those files things like httpd.conf.orig or httpd.conf.091709

As always, the best way to learn this operating system is to break it…however unintentionally.

49 Wolf Halton 09.21.09 at 3:16 pm

Attempting to update a Fedora box over the wire from Fedora8 to Fedora9
I updated the repositories to the Fedora9 repos, and ran
# yum -y upgrade
I have now tested this on a couple of boxes and without exception the upgrades failed with many loose older-version packages and dozens of missing dependencies, as well as some fun circular dependencies which cannot be resolved. By the time it is done, eth0 is disabled and a reboot will not get to the kernel-choice stage.

Oddly, this kind of update works great in Ubuntu.

50 Ruben 09.24.09 at 8:23 pm

while cleaning the backup hdd late the night, a ‘/’ can change everything…

“rm -fr /home” instead of “rm -fr home/”

It was a sleepless night, but thanks to Carlo Wood and his ext3grep I rescued about 95% of data ;-)

51 foo 09.25.09 at 9:36 pm

# svn add foo
—-> Added 5 extra files that were not to be commited, so I decided to undo the change,delete the files and add to svn again…..
# svn rm foo –force

and it deleted the foo directory from disk :(…lost all my code just before the dead line :(

52 foo 09.25.09 at 9:41 pm

wanted to kill all the instances of a service on HP-UX (pkill like util not available)…

# ps -aef | grep -v foo | awk {print’$2′} | xargs kill -9

Typed “grep -v” instead of “grep -i” and u can guess what happened :(

53 LinAdmin 09.29.09 at 2:38 pm

Typing rm -Rf /var/* in the wrong box. Recovered in few minutes by doing scp root@healty_box:/var . – the ssh session on the just broken box was still open . This saved my life :-P

54 Deltaray 10.03.09 at 4:37 am

Like Peko above, I too once ran pkill with the -v option and ended up killing everything else. This was on a very important enterprise production machine and I reminded myself the hard lesson of making sure you check man pages before trying some new option.

I understand where pkill gets its -v functionality from (pgrep and thus from grep), but honestly I don’t see what use of -v would be for pkill. When do you really need to say something like kill all processes except this one? Seems reckless. Maybe 1 in a million times you’d use it properly, but probably most of the time people just get burned by it. I wrote to the author of pkill about this but never heard anything back. Oh well.

55 Guntram 10.05.09 at 7:51 pm

This is why i never use pkill; always use something like “ps ….| grep …” and, when it’s ok, type a ” | awk ‘{print $2}’ | xargs kill” behind it. But, as a normal user, something like “pkill -v bash” might make perfect sense if you’re sitting at the console (so you can’t just switch to a different window or something) and have a background program rapidly filling your screen.

Worst thing that ever happened to me:
Our oracle database runs some rdbms jobs at midnight to clean out very old rows from various tables, along the line of “delete from XXXX where last_access < sysdate-3650". One sunday i installed ntp to all machines, made a start script that does an ntpdate first, then runs ntpd. Tested it:
$ date 010100002030; /etc/init.d/ntpd start; date
Worked great, current time was ok.
$ date 010100002030; reboot
After the machine was back up i noticed i had forgotten the /etc/rc*.d symlinks. But i never thought of the database until a lot of people were very angry monday morning. Fortunately, there's an automated backup every saturday.

56 sqn 10.07.09 at 6:05 pm

tried to lockout a folder by removing it’s attributes (chmod 000) as a beginner and wanted to impress myself, did:

# cd /folder
# chmod 000 .. -R
used two points instead of one, and of course the system used the upper folder witch is / for modifying attributes
ended up getting out of my home and go the the server to reset the permissions back to normal. I got lucky because i just did a dd to move the system from one HDD to another and I haven’t deleted the old one yet :)
And of course the classical configuring the wrong box, firewall lockout :)

57 dev 10.15.09 at 10:15 am

while I was working on many ssh window:

rm -rf *

I intended to remove all files under a site, after changing the current working
directory, then replacing with the stable one

wrong window, wrong server, and I did it on production server xx((
just aware the mistakes 1.5 after typing [ENTER]
no backup. maybe luckily, the site was keep running smooth..

it seems that the deleted files were such images, or media contents
1-2 secs incidental removal in heavy machine gave me loss approx. 20 MB

58 LMatt 10.17.09 at 3:36 pm

In a hurry to get a db back up for a user, I had to parse through nearly a several terabyte .tar.gz for the correct SQL dumpfile. So, being the good sysadmin, I locate it within an hour, and in my hurry to get db up for the client who was on the phone the entire time:
mysql > dbdump.sql
Fortunately I didn’t sit and wait all that long before checking to make sure that the database size was increasing, and the client was on hold when I realized my error.
mysql > dbdump.sql — SHOULD be —
mysql < dbdump.sql
I had just sent stdout of the mysql CLI interface to a file named dbdump.sql. I had to re-retrieve the damn sqldump file and start over!
BAH! FOILED AGAIN!

59 Mr Z 10.18.09 at 5:13 am

After 10+ years I’ve made a lot of mistakes. Early on I got myself in the habit of testing commands before using them. For instance:

ls ~usr/tar/foo/bar then rm -f ~usr/tar/foo/bar – make sure you know what you will delete

When working with SSH, always make sure what system you are on. Modifying system prompts generally eliminates all confusion there.

It’s all just creating a habit of doing things safely… at least for me.

60 chris 10.22.09 at 11:15 pm

cd /var/opt/sysadmin/etc
rm -f /etc

note the /etc. It was supposed to be rm -rf etc

61 Jonix 10.23.09 at 11:18 am

The deadline were coming too close to comfort, I’d worked for too looong hours for months.

We were developing a website, and I was in charge of developing the CGI scripts which generated a lot of temporary files, so on pure routine i worked in “/var/www/web/” and entered “rm temp/*” which i misspelled at some point as “rm tmp/ *”. I kind of wondered, in my overtired brain, what took so long for the delete to finish, it should only be 20 small files that is should delete.

The very next morning the paying client was to fly in and pay us a visit, and get a demonstration of the project.

P.S Thanks to Subversion and opened files in Emacs buffers I managed to get almost all files back, and I had rewritten the missing files before the morning.

62 Cougar 10.29.09 at 3:00 pm

rm * in one of my project directory (no backup). I planned to do rm *~ to delete backup files but used international keyboard where space was required after ~ (dead key for letters like õ)..

63 BattleHardened 10.30.09 at 1:33 am

Some of my more choice moments:

postsuper -d ALL (instead of -r ALL, adjacent keys – 80k spooled mails gone). No recovery possible – ramfs :/

Had a .pl script to delete mails in .Spam directories older than X days, didn’t put in enough error checking, some helpdesk guy provisioned a domain with a leading space in it and script rm’d (rm -rf /mailstore/ domain.com/.Spam/*) the whole mailstore. (250k users – 500GB used) – Hooray for 1 day old backup

chown -R named:named /var/named when there was a proc filesystem under /var/named/proc. Every running process on system got chown.. /bin/bash, /usr/sbin/sshd and so on. Took hours of manual find’s to fix.

.. and pretty much all the ones everyone else listed :)

You break it, you fix it.

64 PowerPeeCee 11.02.09 at 1:01 am

As an Ubuntu user for a while, Y’all are giving me nightmares, I will make extra discs and keep them handy. Eek! I am sure that I will break it somehow rather spectacularly at some point.

65 mahelious 11.02.09 at 10:44 pm

second day on the job i rebooted apache on the live web server, forgetting to first check the cert password. i was finally able to find it in an obscure doc file after about 30 minutes. the resulting firestorm of angry clients would have made Nero proud. I was very, very surprised to find out I still had a job after that debacle.

lesson learned: keep your passwords secure, but handy

66 Shantanu Oak 11.03.09 at 11:20 am

scp overwrites an existing file if exists on the destination server. I just used the following command and soon realised that it has replaced the “somefile” of that server!!
scp somefile root@192.168.0.1:/root/

67 thatguy 11.04.09 at 3:37 pm

Hmm, most of these mistakes I have done – but my personal favourite.

# cd /usr/local/bin
# ls -l -> that displayed some binaries that I didn’t need / want.
# cd ..
# rm -Rf /bin
– Yeah, you guessed it – smoked the bin folder ! The system wasn’t happy after that. This is what happens when you are root and do something without reading the command before hitting [enter] late at night. First and last time …

68 Gurudatt 11.06.09 at 12:05 am

chmod 777 /

never try this, if u do so even root will not be able to login

69 richard 11.09.09 at 6:59 pm

so in recovering a binary backup of a large mysql database, produced by copying and tarballing ‘/var/lib/mysql’, I untarred it in tmp, and did the recovery without incident. (at 2am in the morning, when it went down). Feeling rather pleased with myself for suck a quick and successful recovery, I went to deltete the ‘var’ directory in ‘/tmp’ . I wanted to type:
rm -rf var/

instead I typed :
rm -rf /var

unfortunatley I didnt spot it for a while, and not until after did I realize that my on-site backups were stored in /var/backups …
IT was a truly miserable few days that followed while I pieced together the box from SVN and various other sources …

70 Henry 11.10.09 at 6:00 pm

Nice post and familiar with the classic mistakes.

My all time classic:
- rm -rf /foo/bar/ * [space between / and *]

Be carefull with clamscan’s:
–detect-pua=yes –detect-structured=yes –remove=no –move=DIRECTORY

I chose to scan / instead of /home/user and I ended with a screwed apt, libs, and missing files from allover the place :D I luckily had –log=/home/user/scan.log and not console output, so I could restore the moved files one by one
next time I use –copy instead of move and never start with /

these 2 happened at home, while working I’ve learned a long time ago (SCO Unix times) to backup files before rm :D

71 Derek 11.12.09 at 10:26 pm

Heh,
These were great.
I have many above.. my first was
reboot
….Connection reset by peer. Unfortunately, I thought I was rebooting my desktop. Luckily, the performance test server I was on hadn’t been running tests(normally they can take 24-72 hours to run)..

symlinks… ack! I was cleaning up space and thought weird.. I don’t remember having a bunch of databases in this location.. rm -f * unfortunately, it was a symlink to my /db slice, that DID have my databases, friday afternoon fun.

I did a similar with being in the wrong directory… deleted all my mysql binaries.

This was also after we had acquired a company and the same happened on one of their servers months before.. we never realized that, and the server had an issue one dady… so we rebooted. Mysql had been running in memory for months, and upon reboot there was no more mysql. Took us a while to figure that out because no one had thought that the mysql binaries were GONE! Luckily I wasn’t the one who had deleted the binaries, just got to witness the aftermath.

72 Ahmad Abubakr 11.13.09 at 2:23 pm

My favourite :)

sudo chmod 777 /

73 jason 11.18.09 at 4:19 pm

The best ones are when you f*ck up and take down the production server and are then asked to investigate what happened and report on it to management….

74 Mr Z 11.19.09 at 3:02 pm
75 John 11.20.09 at 2:29 am

Clearing up space used by no-longer-needed archive files:

# du -sh /home/myuser/oldserver/var
32G /home/myuser/oldserver/var
# cd /home/myuser/oldserver
# rm -rf /var

The box ran for 6 months after doing this, by the way, until I had to shut it down to upgrade the RAM…although of course all the mail, Web content, and cron jobs were gone. *sigh*

76 Erick Mendes 11.24.09 at 7:55 pm

Yesterday I’ve locked my self outside of a switch I was setting up. lol
I was setting up a VLAN on it and my PC was directly connected to it thru one of the ports I messed up.

Had to get thru serial to undo vlan config.

Oh, the funny thing is that some hours later my boss just made the same mistake lol

77 John Kennedy 11.25.09 at 2:09 pm

Remotely logged into a (Solaris) box at 3am. Made some changes that required a reboot. Being too lazy to even try and remember the difference between Solaris and Linux shutdown commands I decided to use init. I typed init 0…No one at work to hit the power switch for me so I had to make the 30 minute drive into work.
This one I chalked up to being a noob…I was on an XTerminal which was connected to a Solaris machine. I wanted to reboot the terminal due to display problems…Instead of just powering off the terminal I typed reboot on the commandline. I was logged in as root…

78 bram 11.27.09 at 8:45 pm

on a remote freebsd box:

[root@localhost ~]# pkg_delete bash

The next time i tried to log in, it kept on telling me access denied… hmmmm… ow sh#t

(since my default shell in /etc/passwd was still pointing to a non-existent /usr/local/bin/bash, i would never be able to log in)

79 Li Tai Fang 11.29.09 at 8:02 am

On a number of occasions, I typed “rm” when I wanted to type “mv,” i.e., I wanted to rename a file, but instead I deleted it.

80 vmware 11.30.09 at 4:59 am

last | reboot
instead
last | grep reboot

81 ColtonCat 12.02.09 at 4:21 am

I have a habit of renaming config files I work on to the same file with a “~” at the end for a backup, so that I can roll back if I make a mistake, and then once all is well I just do a rm *~. Trouble happened to me when I accidentally typed rm * ~ and as Murphy would have it a production asterisk telephony server.

82 bye bye box 12.02.09 at 7:54 pm

Slicked the wrong box in a production data center at my old job.

In all fairness it was labeled wrong on the box and kvm ID.

Now I’ve learned to check hostname before decom’ing anything.

83 Murphy's Red 12.02.09 at 9:11 pm

Running out of diskspace while updating a kernel on FreeBSD.

Not fully inserting a memory module on my home machine which shortcircuited my motherboard.

On several occasions i had to use a rdesktop session to windows machine and use putty to connect to a machine (yep.. i know it sounds weird ;-) ) Anyway.. text copied in windows is stored differently than text copied in the shell. Why changing a root passwd on a box, (password copied using putty) i just control v-ed it and logged off. I had to go to the datacenter to boot into single user mode to acces the box again.

Using the same crappy setup, i copied some text in windows, accidently hit control-v in the putty screen of the box i was logged into as root, the first word was halt, the last character an enter.

Configuring nat on the wrong interface while connected through ssh

Adding a new interface on a machine, filled in the details of a home network in kudzu which changed the default gateway to 192.168.1.1 on the main interface. Only checking the output of ifconfig but not the traffic or gateway and dns settings.

fsck -y on filesystem without unmounting it

84 ehrichweiss 12.03.09 at 6:55 pm

I’ve definitely rebooted the wrong box, locked myself out with firewall rules, rm -rf’ed a huge portion of my system. I had my infant son bang on the keyboard for my SGI Indigo2 and somehow hit the right key combo to undo a couple of symlinks I had created for /usr(I had to delete them a couple of times in the process of creating them) AND cleared the terminal/history so I had no idea what was going on when I started getting errors. I had created the symlink a week prior so it took me a while to figure out what I had to do to get the system operational again.

My best and most recent FUBAR was when I was backing up my system(I have horrible, HORRIBLE luck with backups to the point I don’t bother doing them any more for the most part); I was using mondorescue and backing the files up to an NTFS partition I had mounted under /mondo and had done a backup that wouldn’t restore anything because of an apostrophe or single quote in one of the file names was backing up, so I had to remove the files causing the problem which wasn’t really a biggie and did the backup, then formatted the drive as I had been planning………..only to discover that I hadn’t remounted the NTFS partition under /mondo as I had thought and all 30+ GB of data was gone. I attempted recovery several times but it was just gone.

85 fly 12.04.09 at 3:55 pm

my personal favorite, a script somehow created few dozens file in /etc dit … all named ??somestrings so i promplty did rm -rf ??* … (at the point when i hit [enter] i remebered that ? is a wildchar … Too late :)) luckily that was my home box … but reinstall was imminent :)

86 bips 12.06.09 at 9:56 am

il m’est arrivé de farie :
crontab -r

au lieu de :
crontab -e

ce qui a eu pour effet de vider la liste crontab…

87 bips 12.06.09 at 9:59 am

also i’ve done

shutdown -n
(i thaught -n meant “now”)

which had for consequence to reboot the server without networking…

88 Deltaray 12.06.09 at 4:51 pm

bips: What does shutdown -n do? Its not in the shutdown man page.

89 miss 12.14.09 at 8:42 am

crontab -e vs crontab -r is the best :)

90 marty 12.18.09 at 12:21 am

the extra space before a * is one I’ve done before only the root cause was tab completion.

#rm /some/directory/FilesToBeDele[TAB]*

Thinking there were multiple files that began with FilesToBeDele. Instead, there was only one and pressing tab put in the extra space. Luckily I was in my home dir, and there was a file with write only permission so rm paused to ask if I was sure. I ^C and wiped my brow. Of course the [TAB] is totally unneccesary in this instance, but my pinky is faster than my brain.

91 fastgsx 12.19.09 at 2:54 am

Worst mistake ever, ran fsck -y on an encrypted volume, trashed the whole partition. You can only check the filesystem after its unlocked and mounted as a logical volume.

92 CB 12.23.09 at 10:40 pm

Worst.
Sysadmin.
Ever.

…nah, just kidding. If anything, you’ve proved your worth by helping newbies like me who don’t know what they are doing.

I’m taking your lessons to heart. Thanks for taking the time to put them out there.

93 Evilnick 12.29.09 at 4:51 pm

heheh. yeah, i think we have all been there.

I always change the default prompt on server boxes, preferably to some flashing, garishly coloured text just to remind me i am not at home any more.

94 Solaris Admin 01.04.10 at 3:57 am

Solars 10 – Hot drive replacement – Lab system

prtvtoc /dev/rdsk/c1t0d0s2 | fmthard -s – /dev/rdsk/c1t1d0s2

…… however c1t1d0 was my good disk… not the one I had just replaced :(

95 Danny 01.06.10 at 7:34 pm


chmod -R www-data:www-data /etc/

Later on….

reboot

SSH never came back up. Wouldn't start with those permissions

96 LongShot 01.08.10 at 8:58 am

My own favorite was “chown -R userx:userx ../*” when I meant ./* in /opt/somdir – it recursed nicely, I cursed not so nicely. In my defence, I was trying to make sure I got the . files. It took many hours to straighten that mess out.

Another favorite was on day one of a new job. The local alpha-geek was hotdogging and he ran a script that pushed a new user into /etc/password on all production servers. But the script had no error checking and he ended up zeroing out /etc/passwd on every single one (30+ HPUX). It was like watching a slow-motion trainwreck. I felt much less intimidated after that ;)

In terms of that sinking feeling, I was telnet’d in to multiple production servers at multiple call centers (pre SSH – yes, I’m that old). One sever started circling the drain (known database ipc problems) and the only solution was a quick reboot before it locked up. I grabbed a window and ran shutdown. Of course it was the wrong window so I took down 250+ people at a remote site and let the sever lock up at my own site for another 250+ people. The remote site was bad enough, but after the hard power-off at my site I had to repair around 20 large ISAM database files which took about two hours. Now I try to use a different background color for each server I connect to.

97 i-ghost 01.09.10 at 5:55 pm

You can always modify /etc/bash.bashrc and add:
alias rm"=rm -i"
Mine reads:
alias rm="
echo -------;
echo Think before you delete...;
echo Use yes on stdin or -f if you must bypass the prompt;
echo You have been warned!;
echo -------;
rm -i"

It’s not the best fix, and there are better ones out there, but it works fine for home desktops.

98 mh166 01.11.10 at 9:41 am

# svn rm foo –force

and it deleted the foo directory from disk :(…lost all my code just before the dead line :(
Oh boy … I did the very same thing leading to everlasting loss of dozens of TEX-files …

Another one happened to me when I was going to create a cronjob that deletes all files older than X days. So I was at the shell in the correct folder and tested it:

find -mtime +23 -print -exec rm -f \{\} \;

Worked like charm … Therefore I was putting it just like that into the crontab and went to sleep. On the next day I got a 8+ Meg Logwatch-Mail … thousands of lines telling me some libs weren’t found.

The bad thing: I didn’t give a starting directory for find, since for testing I did cd to it … Therefore the cron started deleting from where it was: right away at / …. Lucky me I had a second box that was almost identically … *pheew*

But of course, the classics have also been done: wrong box, firewall lockout, halt instead of reboot, deleting the just-restored files from the production-directory instead of the temporary location under /tmp … there was lots of fun. And i bet there will be much more waiting for me to happen. ;)

Regards,
mh166

99 Not Available 01.13.10 at 6:31 pm

Copying many gigs of stuff with dd command. If you mix the source and destination, you very precisely make of copy of the blank disk over whatever it was you thought you were copying.

100 KING SABRI 01.14.10 at 2:25 pm

I was Make Fatal Mistake also

yum -y remove *python*

it’s make damage to most of programs :(

thank you Vivek

101 sidhabo 01.15.10 at 8:07 am

Doing a lot of copy/paste from installation manuals always risky. Like copy with this not too unusual prompt:

hostname :> /bin/sh

If you mistakenly copy not only /bin/sh you end up wiping out whatever executable you where trying to run ( in this case /bin/sh ) by doing

# :> /bin/sh

102 Luke Seelenbinder 01.15.10 at 8:28 pm

Worst mistake:

rm -rf /*
I meant this:
rm -rf ./*

Yes… production server. Yes… I had to totally reinstall the system. Yes… I didn’t have a current backup. And you guys that you did stupid stuff. :-)

103 Justin Anthony 01.18.10 at 2:27 am

i dont consider myself a noob but i did the most noobish thing in the world today

ls -a > ls

Nothing wrong with it, except i was in the /bin directory testing some new shell scripts

I couldnt figure out why my ls command would return a blank on every folder.

104 vicky 01.20.10 at 3:12 pm

It was really great of u all to write these mistakes.I have just started on, and would always remember to check and check again, the commands I use !! :)

105 Sam Watkins 01.20.10 at 7:59 pm

One mistake I made was to run “slay” as an unprivileged user. This damn program by default (mean mode) will kill all your own processes in that case. It shouldn’t be shipped like that in a serious distro like Debian or Ubuntu, but they ignored my complaint.

106 Yogesh 01.21.10 at 12:23 pm

I used
rm -rf *
instead of
rm -rf xxx.*
That too in tomcat server home directory. In result needed install tomcat server one more time. :)

107 matt 01.22.10 at 4:48 am

instead of sudo sh -c ‘cat /etc/passwd > /etc/passwd.core’

i did:

sudo sh -c ‘cat > /etc/passwd /etc/passwd.core’

needless to say this made the system useless. i’m not sure why i was even doing this when i could have done sudo cp /etc/passwd /etc/passwd.core. it think it’s because i sometimes do sudo sh -c ‘head -25 /etc/passwd > /etc/passwd.core’. the lucky part was that this server was not in production yet.

108 heinzharald 01.26.10 at 12:05 am

Nice. Thank you for openly sharing. For all the “rm” errors – I’ve learned the hard way and have replaced “rm” via alias in bash to “rm -i” that way I get a wakeup call as soon as I want to delete big-time. I have to type “/bin/rm” to bypass it.

109 Eddie 01.26.10 at 1:08 am

One time I typed g++ -o program.cpp program.cpp instead of
g++ -o program program.cpp!

It was a final proyect program, so I had to write it all over again in a couple of hours.

One of my coworkers did: apt-get remove perl
At first sight it does not seem to dangerous, but it removed many programs, including the X environment and even the apt applications, according to him.

I used that command on my old computer when I got a new one, just to see what happened. :D

110 Zachary 01.26.10 at 4:24 am

The amount of advertising on this site is disgusting.

111 Paul 01.27.10 at 12:26 pm

# cat /dev/nul >/etc/motd
came out for some reason as
cat /dev/nul >/etc/passwd
GOK why. A senior moment near going home time. Couldn’t find any old passwd files around so had to invent one with root in so I could log in at the console and extract the original from the backup tape. ps showed the users as numbers. No one noticed but my boss went into a sweat when I told him the next day :) SCO box. Last millennium!

112 heinzharald 01.27.10 at 3:24 pm

@Zachary
What ads? I use Adblock Plus for Firefox – not one f**kin ad left :-)

113 DirtySaint 01.27.10 at 7:04 pm

hah! Hah!…majority seem to hv turtured “rm” to death. Surprisingly “rm” is still around…
anyways my personal goof-up, about twenty years back, when there was no way of knowing where u r in the filesystem – except using “pwd”…no bash, no helpful PS1 configured to show ur current location, etc. (Actually after this episode I created a small script to show the current location).

So here I was on a Xenix 286 system (apparently a unix “developed”/supplied by Microsoft), in single user mode and thinking I was in “/tmp”, issued “rm -r *” (during those days /tmp was just a simple directory)…

Well! Instead of “/tmp” I was in “/” …rest u can imagine…also in those days “rm” was much more powerful…I don’t recall whether “-f” switch was yet invented or for that matter “-i”. Or maybe I was unaware!…”rm” was pretty raw and did what it was asked to do – no questions asked!

But from that day I treat “rm” as my extra-marital wife…be real careful…

114 Ben 01.28.10 at 12:30 pm

I had a Mail-System with a IMAP-Maildir-Structure. For any reason a single Maildir was created under root. And the Name of the User had an german mutated vowel in its name – so the name was not /.foo but /.foaer& or something. (Maildirs had a point in front of the name to know its a maildir) I copied the hole directory to the home-directory and wanted to delete the directory under root – and typed rm -rf . foaer& (you see this little space….). Now I had to do another work on the same machine – and i had to download a package with 300MB – i took wget and waited till it had been downloaded. But when half of the package was ready there comes a line behind the progress bar says: already deleted. Now I becomed scared – because of the “&” as last letter in the name of the directory – and then in the command – rm -rf erased the hole disk in the background…. And my last backup was about 2 weeks old – so, the hole company lost 2 weeks of mails – and i had a 24 hours job to completly setup the mail-server again – and this happend sunday night – my company startet at 06:00 o´clock in the morning to work. What a shitty night… But, after this there was a budget for a new Mail-Backup-System^^

So always be careful with mutated vowels and rm -rf!

115 glee 01.28.10 at 3:36 pm

route -f xxx

I was trying to add a backup route to a primary sybase server and didn’t include the “hop count”. Since it didn’t work, I tried to “force” it and ended up deleting all routes from the routing table. :/

116 Phyrstorm 01.29.10 at 1:53 am

Done just about all of the above. The worst I have done is dropped the public interface on a production server at a conference center in the middle of DefCon 17 at the Riviera. Luckily there was IT on site to get the system rebooted within 5 minutes.

117 r4pP157 01.29.10 at 5:28 pm

On a production Oracle RAC server, while connected to the console of one of the nodes through the system controller I typed:

~.

Which sent the server to OBP, halting the OS
instead of typing:

~~#

To exit console and go back to system controller.
Luckily that one time, the other node was up.

118 CuriousJoe 01.31.10 at 11:41 pm

I had a usb drive with many folders of photos of my home in a main folder called “home”. I accidentally copied these as root and the folder was thus owned by root. Later on another computer went to this directory noticed the permission problem, switched to root, copied the photos and mysteriously typed:
rm -rf /home
in that situation that one “/” costs me a whole days work. Daft mistake, a well, live and learn.

119 GuyK 02.02.10 at 12:15 pm

Is there a smart way to chmod an entire path, like mkdir -p ?
As I typed , I forgot to remove an usual -R :

cd /any/deep/path/to/allow/
chmod -R a+rx ../../../../..

oups. all the server was chmoded ….
luckily it was on a virtual machine. reload and reinstall.

120 Gilles Detillieux 02.04.10 at 5:25 pm

After accidentally rebooting the wrong server a couple times, forgetting what I had ssh’ed to, I decided on a handy fix, this /usr/local/bin/confirm script:

#!/bin/sh
echo "You are about to run the command '$*' on `hostname`." >&2
echo -n "Are you sure this is what you want to do? (Y/N): [N] " >&2
read x || exit
case "$x" in
[Yy]*)  exec "$@" ;;
*)      echo "Command '$*' aborted." >&2  ; exit 1 ;;
esac

Now, on my servers I add these aliases to root’s .bashrc file:

alias halt=’confirm halt’; alias reboot=’confirm reboot’

That’s saved me a few times since then. The .bashrc file also already had the “alias rm=’rm -i’” in there, which at first I hated, but learned to like it after it too saved my skin on more than one occasion.

121 Vivek Gite 02.04.10 at 6:06 pm

@Gilles

Nice hack. I wish I had some sort of mod points here :)

122 Mike 02.09.10 at 7:36 pm

I accidentally deleted /etc. I had restored /etc to another location and just went in and didn’t put the correct path in the command. That was a painful mistake.

123 Salim 02.10.10 at 10:01 am

Accidently rebooted servers…best is uname -a before you hit reboot command.
Wrongly plugged Sun M-series with one input 110V and 220v on the other. Server wouln’t start whatsover you do…
Best backup is dump or ufsdump (solaris), most of the time tar and cpio may lead you to loose your job.

124 Otto 02.11.10 at 2:00 pm

Adding a user to a group:
# usermod -G groupname username

If you forget the -G, you’ll have all the current user groups replaced by the one you thought you were adding.

Very tricky.

125 nathan 02.13.10 at 12:37 am

@Otto — I did basically that to myself with sudo,

# sudo usermod -G groupname myusername

I was immediately no longer a member of ‘wheel’ and was no longer allowed to sudo.

126 Sarper 02.14.10 at 10:07 am

I have screwed myself most ways mentioned.
My shining moment was building a firewall for a local government site.
They said port 1049 was experiencing lag, so to debug I decided to clear the firewall.
INPUT and OUTPUT were set to reject and I typed:
iptables -X
really bad part? It was a no-access VM, had to call the host to chroot and release.

ALWAYS DO THIS:

iptables -A INPUT -j ACCEPT && iptables -A OUTPUT -j ACCEPT && iptables -X

127 Anonymous coward 02.15.10 at 12:45 am

tar -czf dirname1 &
tar -czf dirname2 &

tar -czf dirname13 &

#Seems like all of them have been tarred and gzipped

rm -rf dirname1
rm -rf dirname2

rm -rf dirname13

#Oh, some of the larger directories weren’t.

128 Andreas 02.15.10 at 7:03 am

I wanted to format my sd-card but I typed:

dd if=/dev/null of=/dev/sda instead dd if=/dev/null of=/dev/sdc

and watched my system beeing formatted in front of me.

129 Fool 02.17.10 at 10:56 am

On a Personal PC, not so much a linux mistake though…

This was in the age of laptops moving to having NO more floppy drives, I needed some way of removing grub as it was no longer needed. Since there were no floppy drives I was searching for an alternative to the win98 bootdisk so I could run a “fdisk /mbr”.

Found a nice little program that I burnt to a disc, that would allow me to modify the boot sector.

… accidently ended up wiping the entire partition table!

130 mordovorot 02.18.10 at 5:49 pm

Here is what I did:

- Backed up /etc directory on a Sun Solaris server:
oldbox> tar cf etc_oldbox.tar /etc

- Transferred the tar to my home directory on the new server and extracted it to get some config files:
newbox> tar xf etc_oldbox.tar

The newbox was killed. Why? The native Sun tar doesn’t remove the leading “/” by default, as GNU tar does. As a result, the whole /etc content was completely overwritten with files from another server. Linux people, be careful with Sun Solaris!

131 Daniel 02.19.10 at 12:56 pm

I saw a fresh installed centos system broken by command:
yum remove python :)

132 Katzider 02.19.10 at 5:59 pm

#init 0
On remote clustering server…

133 Mike Davies 02.21.10 at 9:05 pm

This was years ago and now I think back about what an idiot I was.
I created a user, mike of course in a box running DEC 4.0E and I decided I wanted more permissions so I decided to make it user 0, just like root. The system actually asked if I was sure I wanted to do this. I said yes….It took me 2 hours to get the system back up and running because it changed every file in the system that was owned by root to mike.
dumb, real dumb.
Being superuser can be a disaster!
I use dd a lot now and make many backups.

134 Kang 02.24.10 at 3:09 pm

Stupid french AZERTY keyboards have the * key located just on the left of the ENTER key.

while typing some :
mv /path/to/file /usr/local/
I pressed the ENTER key… pressing the * key at the same time :)
It ended up executing :
mv /path/to/file /usr/local/*
which moved every dirs in /usr/local into the last directory in /usr/local

Since then, I’m using only QWERTY keyboards ^^

135 james 02.24.10 at 3:57 pm

On at least three entirely seperate occasions I’ve been on the command line within a C project I’ve been writing and gone to remove backup files:

rm *~

but been distracted after typing the asterisk and then switched back to the terminal and immediately pressed enter forgetting about the tilde sign. Immediately deleting weeks worth of *.c files.

Luckily I found ext3undelete, and while I did recover my files, it painfully insisted upon recovering the entire partition. Which of course happened to be the largest partition. So I then spent the rest of the evening not only waiting for it to restore the files I actually wanted, but manually deleting everything it restored which I had *not* deleted in the first place so the partition I was restoring to, did not run out of space before the files I actually deleted were restored!

136 zeve 03.04.10 at 8:45 am

I did:
# route -f
on my early first days, ended up with no routes.

137 philbo 03.04.10 at 2:49 pm

A nice old one – not by me but by a less-than-worthy colleague, who liked to do everything as root on the server box:

WHAT HE MEANT : last | grep reboot

WHAT HE TYPED : last | reboot

138 Micha 03.04.10 at 7:45 pm

“Best thing” happend to me. Tried to clone a Serversys after 12 hours configuration.
But typed: dd if=/dev/sad of=/dev/sda bs=1024
Work was done for nothing. Samething even happend on Windows Server 2008 Backup Tool.
What have I learned, check your syntax and read warnings when they appear … they are usefull at least for something …

139 Nick 03.08.10 at 6:15 am

I work as a student worker at a university and as a web developer there have some limited sudo access on the production web server. They upgraded to a new server and didn’t warn me that they hadn’t made bash the primary shell. So, naturally I typed the same commands I always have to change ownership of a folder to myself so I could make some changes to files and inevitably changed ownership of the whole server to myself! Oops!

sudo chown -R user folder [tab] / didn’t execute the same as sudo chown -R user folder/

140 Barius 03.08.10 at 2:22 pm

We had a cas of rm -rf / at work recently, but thankfully I was not the culprit. After that, they renamed the OPS team to OOPS.

My fav was a laptop which dual-booted windows 2000 / linux. I installed VMware under w2k with raw disk access, which allowed me to boot the linux partition as a VM while runnining windows. This worked great for about a year, until I gave the wrong partition number to mke2fs and formatted the NTFS as EXT2 while w2k was running. W2k didn’t even notice until it’s fs cache was cleaned out by a reboot. After that it was–how shall I say–completely fscked.

141 Kenneth Heal 03.09.10 at 9:19 pm

Once I installed a Linux server and forgot to log out of the local console. I noticed this and foolishly decided to pkill all the users processes. The user happened to be root and one of its processes was sshd; thus meaning I locked myself out of the box.

142 matt 03.12.10 at 3:50 pm

The best one I have seen (and had to rebuild the server afterwards was someone’s Q&D tidy up script to clean old files out of /tmp…

cd /temp; find . -mtime +30 -exec rm -f {} \;

Practically everything on that line was fine… except it failed to complete the change directory and then went it’s happy way from / deleting anything that hadn’t been changed in the last month until it hit something important at which point the serverwent down. It was run by cron as root in the wee small hours so no-one spotted the effect until the next morning.

The best thing about this apart from it not being _me_ that executed the command… the management believed the line that it was a virus… on AIX a decade ago.

143 matt 03.12.10 at 4:02 pm

Oh, I forgot the other really funny error… customer who wouldn’t use vi… copy /etc/passwd to a PC using Windows built-in ftp, add a user in to it in notepad and then use ftp to put it back… and added a ^M to all of the entries!

A call in late afternoon… ‘I can’t log on. Help!’

144 George 03.17.10 at 7:59 pm

First week with my new Ubuntu…
- Program: Libc6 needs to be updated to run
- User:
- User: sudo apt-get remove libc6
- System: WARNING: DELETING THIS LIBRARY MAY AFFECT YOUR SYSTEM. TYPE ‘I’M AWARE OF THIS AND WANT TO CONTINUE’ IF YOU WANT TO PROCEED.
- User: types ‘I’M AWARE OF THIS AND WANT TO CONTINUE’ …
- System: *sigh*… ok… deleting everything that depends on C (the whole system)
- User: open eyes, stomach twists, push “Power” button in panic
- User: restart computer, nothing works. Grub had problems, can’t access windows installation. Doesn’t have Live CD. Has to ask to friends for a Live CD, and explain the whole story every time.

145 I know this guy... 03.17.10 at 11:49 pm

Can’t top the keystrokes, but think I’ve got a top 10 spot for consequences:

One of those ’start rebuilding the wrong box in a failed redundant pair’ scenarios.
Sadly it was the dispatch note / purchase order processing system for largest European lights-off central distribution center in a very big industry sector, and config had been ‘evolved’ or time.
Result: they couldn’t dispatch anything and had to turn away every delivery for a day and a half. We are talking about a hundred cross-continental trucks sent back to their depots empty, or still full.
I could tell you that it wasn’t me, but I don’t expect anyone to believe that.

Moral: Never, ever, ever trust a sticky label – look at the prompt, and if the prompt doesn’t tell you: change it so it does. SVN’ed config would have massively reduced down time too.

Leave a Comment

You can use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Previous post:

Next post: