What are the worst/best unix shell nightmares? My favourites are:
rm -rf / tmp/foo
(deletes everything if you are root; typo :-( )rm -rf .*
(deletes everything if you are root; not just all hidden files)- Files in
*
that are used as parameters, e.g. aftertouch -- -rf
,rm *
eventually evaluates torm -rf foo bar
cat foo | sed 's/foo/bar/g' > foo
(deletes foo)some_command > /dev/sda
WARNING: Do not try any of these or the following commands!
From stackoverflow
-
:(){ :|:& };:
Warning: DO NOT DO THIS
This is a fork bomb. The equivalent of:
while (1) { fork(); }
Only do it as a test on a machine you have physical access to. You need to be able to hard reset :D
Johannes Weiß : I also thought about that one, but when do you type in that by accident ;-)?Sean Bright : You never mentioned "by accident" :)Scottie T : So for those of us who might just be curious enough to ssh into our boss' terminal and try that out, what does that do?Johannes Schaub - litb : Johannes, haha yeah i also thought whether i should answer with that :p though i would probably never write it by accident. but i think sean is right: you omitted to mention you meant "accident" stuff :)agnul : @Scottie: see http://en.wikipedia.org/wiki/Fork_bombskinp : Classical Fork Bomb :D. Run "ulimit -u 30" if you want to try this one out... You'll limit the fork bomb to spawn only 30 processSean Bright : I ran this while SSH'd into my home machine from work before I knew what it was. When I got home the fan in the machine was running so fast it sounded like a jet engine in my office.Johannes Schaub - litb : yeah haha i once run that code too, when i thought my machine won't crash and i could easily kill shell (oh no, i could not!) :pMatthieuP : I think this is lcamtuf signature, right ? -
dd if=/dev/urandom of=/dev/hda
Wipe out entire disk with random data.
-
cat /dev/random > /dev/hda # oops, why don't i hear sound? oh noes, i meant /dev/dsp!
The code above was given in a suse linux manual as an example why working as root is dangerous. I guess the user doing that mistake learned something for life.
Joachim Sauer : that's why you should not work as root ;-)Paul Tomblin : saua, you wrote that while I was writing the same thing in the question.
0 comments:
Post a Comment