Video at http://www.youtube.com/watch?v=DTWZqh64RcQ.
...
Video at http://www.youtube.com/watch?v=DTWZqh64RcQ.
You're in a Data Center, with absolutely no contact with the outside world, with a machine that you must not restart, and someone performed a `chmod -x chmod`.
This is a problem we used in interviews during 2009, and this presentation is a list of some of the possible solutions that my co-workers at SAPO have suggested.
stevebeattieOn linux, it’s much, much easier. You see, when you execute an ELF executable, the kernel does some mapping and then hands the rest of process setup off to ld.so(1), which is treated somewhat like a (hardware backed) interpreter for ELF files, much like /bin/sh inteprets shell scripts, perl interprets perl scripts, etc. And just like you can invoke a shell script without the executable bit via ’/bin/sh your_script’, you can do:
(paths are taken from an Ubuntu 10.10 system and may vary on other distros.)2 years ago
Are you sure you want to
Antonio Ognio, Software Developer / Ingeniero de Sistemas at Aureal Systems S.A.C, Miraflores, PerúI totally thought of the same kind of solution presented by Kevin Benton in the second comment. You still have read permission on the original chmod binary so if you simply dump its contents into another file that already has executable permissions you’ll be fine. In order to avoid ’sacrificing’ any other executable you can simple make a copy of any working executabe and you’re done.
Kevin BentonThis one is easy, just ’mv /bin/chmod /bin/chmodold’ then ’cp /bin/chown /bin/chmod’, and finally ’cat /bin/chmodold > /bin/chmod’. It's incredible that they came up with so many convoluted answers and skipped this.2 years ago
Are you sure you want to
Alex Pilosovdebugfs, change permissions in there. may need to flush things out of cache.2 years ago
Are you sure you want to
Alex ButcherA bit round about, but create a dummy file, mkdosfs it, mount it loopback, then copy the chmod binary into it.2 years ago
d
un teste
• attrib or ls -@
• force the inode into cache
• check kcore for the VFS structures
• use sed to alter the execution bit without
the kernel realizing it
• run chmod +x chmod
Text editors
sometimes need
to overwrite a file
Thus, some of them
have something
resembling chmod
Emacs
Ctrl+x b > *scratch*
(set-file-modes "/bin/chmod" (string-to-number "0755" 8))
Ctrl+j
There seem to be
countless solutions
But one of the best
answers I’ve seen...
Was from a guy who replied to my
“Solve the problem”
with...
“What problem?
Isn’t the machine still
running?”
The End
(for now)
Let LinkedIn power your SlideShare experience
+
Let LinkedIn power your SlideShare experience
Customize SlideShare content based on your interests
We will import your LinkedIn profile and you will be visible on SlideShare.
Keep up to date when your LinkedIn contacts post on SlideShare
# /lib/ld-linux.so.2 /bin/chown +x /bin/chown
or on x86_64 systems:
# /lib/ld-linux-x86-64.so.2 /bin/chown +x /bin/chown
(paths are taken from an Ubuntu 10.10 system and may vary on other distros.) 2 years ago
I immediately thought of something like this:
$ sudo su -
# cd /bin
# cp bash chmod2
# cat chmod > chmod2
# chmod2 +x chmod
# rm chmod2
# exit
Just tried in on my Macbook starting from chmod -x /bin/chmod and it works perfectly fine.
Only cp and cat needed with this approach. 2 years ago
It's incredible that they came up with so many convoluted answers and skipped this. 2 years ago