News for hackers. Stuff that matters.
Re:Count to ten when a plane goes down by kstenerud on Tuesday July 22, 2014 @10:10AM (#8069044)
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?

Re:Count to ten when a plane goes down by lcedp on Tuesday July 22, 2014 @12:15PM (#8069726)
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

Re:Count to ten when a plane goes down by talmand on Tuesday July 22, 2014 @10:38AM (#8069191)
The worst unix disaster ever? Could you elaborate for non-unix people such as myself?
Re:Count to ten when a plane goes down by smwht on Tuesday July 22, 2014 @10:59AM (#8069313)
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.
Re:Count to ten when a plane goes down by talmand on Tuesday July 22, 2014 @11:24AM (#8069450)
Yep, that's bad.

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

Re:Count to ten when a plane goes down by mianosm on Tuesday July 22, 2014 @11:50AM (#8069592)
Possibly a cp or an scp from a remote system with a working set of binaries.
Re:Count to ten when a plane goes down by kstenerud on Tuesday July 22, 2014 @11:58AM (#8069641)
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.
Re:Count to ten when a plane goes down by Tyr42 on Tuesday July 22, 2014 @10:42AM (#8069210)
Oh no, that redirect!