5 ms·
But the superuser privileges should have overridden such directory permissions, even 25 years ago....
by fjarlq 12y ago
But the superuser privileges should have overridden such directory permissions, even 25 years ago....
- DmitriRavinoff 12y agoYes, but if you can't run the chmod binary...
- fjarlq 12y agoNo, 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
- pantalaimon 12y ago> Like compile a C program that calls the chmod system call The compiler wouldn't be executable anymore either
- claviola 12y agoYes, it would. Like he said, you can still run it unless you specifically removed its permissions.
- mtdewcmu 12y agoThe 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.
- johnchristopher 12y agoMy 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.
- mtdewcmu 12y agoI 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.
- r4um 12y agoOne 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.