Hacker News new | past | comments | ask | show | jobs | submit login

The worst unix disaster I ever saw happened to one of my co-workers. He was working on a client machine, logged in as root because he needed to compile and install some complicated software. As he was working, he did an ls -l /bin and copy-pasted it to a text editor so he could make sure everything was installed correctly. Unfortunately, after returning to his console, he accidentally hit paste. Most of /bin was actually symlinked somewhere else. As you know, ls shows symlinks like this:

lrwxrwxrwx 1 root root 20 Apr 27 17:02 cc -> /etc/alternatives/cc

Guess what happens when you paste a whole list of those into a console as root?




That's fascinating.

To prevent this from happening with me, I've added the following line to my `.Xdefaults`

    URxvt.perl-ext: confirm-paste
(I'm using `rxvt-unicode`)

http://i.imgur.com/joHRXaH.png


The worst unix disaster ever? Could you elaborate for non-unix people such as myself?


The important character here is the '>'. This redirects output to a file and overwrites the file. The lrwxrwxrwx will only print an error, but the redirect to the target executable will erase the target.

For example:

  $ echo "asdf" > foo
  $ cat foo
  asdf
  $ lrwxwrwxrwx 1 root root -> foo
  lrwxrwxrwx: command not found
  $ cat foo
  $
So basically, this zero'd out every executable on the system.


Yep, that's bad.

Out of curiosity, what was the solution to fix all that?


Possibly a cp or an scp from a remote system with a working set of binaries.


scp was in /usr/bin, so we could at least copy enough basics from another system and recover the rest from a backup. Needless to say we lost the client contract.


Oh no, that redirect!




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: