News for hackers. Stuff that matters.
Re:Rm -rf remains by adrianhoward on Saturday June 14, 2014 @03:32AM (#7892292)
About 25 years ago I saw somebody do a "chmod a-rwx ." as root, at root on an SunOs box. Recovering from that was almost entertaining ;-)
Re:Rm -rf remains by onthedole on Saturday June 14, 2014 @07:50PM (#7893995)
A few years ago I changed over from a Dell PC Keyboard to an Apple keyboard.

I had to delete some files in a temp folder and typed the command as I was always used to, and pressed enter.

Immediately realised something was wrong and then saw the "*" replaced with a "/". Did not have a fun afternoon.

http://i.imgur.com/4k4SOpF.jpg

Re:Rm -rf remains by pbhjpbhj on Saturday June 14, 2014 @01:02PM (#7893139)
My worst has been accidentally removing zip - back in my Slackware days IIRC. I was trying to upgrade and so I removed the old one and then went to install the new one and couldn't install it again as the packager used zip and all the downloads I could find were tar.gz (or tar.bz2 or whatever).

That was the first, and last time I think, that I used cpio. Phew.

Re:Rm -rf remains by fjarlq on Saturday June 14, 2014 @03:49AM (#7892308)
But the superuser privileges should have overridden such directory permissions, even 25 years ago....
Re:Rm -rf remains by DmitriRavinoff on Saturday June 14, 2014 @04:18AM (#7892347)
Yes, but if you can't run the chmod binary...
Re:Rm -rf remains by fjarlq on Saturday June 14, 2014 @04:24AM (#7892357)
No, root can still run chmod, because its superuser privileges override the new restrictive directory perms. That was my point.

Maybe the original problem was actually "chmod a-rwx /bin/chmod" ... That would mean even the superuser couldn't execute /bin/chmod anymore, so you'd have to do something more creative to reset the executable bit on /bin/chmod. Like compile a C program that calls the chmod system call, or:

  mv /bin/chmod /bin/chmod.orig
  cp -p /bin/ls /bin/chmod
  cp /bin/chmod.orig /bin/chmod
Re:Rm -rf remains by pantalaimon on Saturday June 14, 2014 @07:52AM (#7892613)
> Like compile a C program that calls the chmod system call

The compiler wouldn't be executable anymore either

Re:Rm -rf remains by claviola on Saturday June 14, 2014 @11:05AM (#7892886)
Yes, it would. Like he said, you can still run it unless you specifically removed its permissions.
Re:Rm -rf remains by mtdewcmu on Saturday June 14, 2014 @04:24AM (#7892359)
The explanation for what made him type that is what interests me. It would be like accidentally cutting your left hand clean off with a steak knife while you were eating dinner.
Re:Rm -rf remains by johnchristopher on Saturday June 14, 2014 @07:25AM (#7892576)
My bash is set to use vim bindings (set -o vi) and I constantly loop through commands. I am guilty of doing this while sleepy and sometimes I think I have cd to another directory when in fact I have not. I rm-ed (too) many things that way.
Re:Rm -rf remains by mtdewcmu on Saturday June 14, 2014 @12:15PM (#7893041)
I gave the vi mode a very short try, but it doesn't seem to make as much sense in a shell. If it has you accidentally deleting things, you might want to ask how much is it really worth. In vim you can undo.
Re:Rm -rf remains by r4um on Sunday June 15, 2014 @07:15AM (#7894995)
One can use the shared library loader to invoke binaries that do not have executable bit set, comes in handy once in a while.

  $ cp /bin/chmod .
  $ chmod -x ./chmod
  $ /lib/ld-2.19.so ./chmod
  ./chmod: missing operand
  Try './chmod --help' for more information.
Re:Rm -rf remains by pbhjpbhj on Saturday June 14, 2014 @01:54PM (#7893222)
My worst has been accidentally removing zip - back in my Slackware days IIRC. I was trying to upgrade and so I removed the old one and then went to install the new one and couldn't install it again as the packager used zip and all the downloads I could find were tar.gz (or tar.bz2 or whatever).

That was the first, and last time I think, that I used cpio.

Re:Rm -rf remains by ibisum on Saturday June 14, 2014 @08:23AM (#7892655)
Oh, the pain! I remember doing that 25 years ago too, ouch.