SlideShare is now on Android. 15 million presentations at your fingertips.  Get the app

×
  • Share
  • Email
  • Embed
  • Like
  • Save
  • Private Content
 

chmod -x chmod

by International Man of Mystery at SAPO on Aug 14, 2010

  • 145,766 views

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.

Statistics

Views

Total Views
145,766
Views on SlideShare
138,231
Embed Views
7,535

Actions

Likes
38
Downloads
353
Comments
14

74 Embeds 7,535

http://www.ende-der-vernunft.org 1537
http://blog.matthew.org.pl 905
http://blog.kwasd.ru 841
http://www.redditmedia.com 815
http://www.shortcut.ru 636
http://krypted.com 502
http://shriphani.com 428
http://www.macdac.ru 392
http://www.joanabotto.com 319
http://elkosmas.gr 237
http://www.musiques-incongrues.net 216
http://www.blog.manhag.org 126
http://www.etanonline.fr 117
http://www.younic.de 85
http://pcampitiello.blogspot.it 56
http://paper.li 54
http://pcampitiello.blogspot.com 44
http://www.robintel.ro 25
http://interactivestemlearningprogramsk-12.blogspot.com 21
http://www.mefeedia.com 18
https://twitter.com 17
http://iam-chen.com 12
http://static.slidesharecdn.com 12
http://a0.twimg.com 10
http://twitter.com 9
http://manhag.org 6
http://webcache.googleusercontent.com 6
http://cetys.blackboard.com 6
http://pcampitiello.blogspot.com.br 6
http://j-reference.blogspot.com 4
http://tumblr.ramimassoud.com 4
http://www.linkedin.com 4
http://beta.shortcut.ru 3
http://pcampitiello.blogspot.co.uk 3
http://translate.googleusercontent.com 3
http://feeds2.feedburner.com 3
http://feeds.feedburner.com 3
http://us-w1.rockmelt.com 3
https://elkosmas.gr 3
http://xss.yandex.net 2
http://interactivestemlearningprogramsk-12.blogspot.co.uk 2
http://pcampitiello.blogspot.fr 2
https://www.shortcut.ru 2
http://pcampitiello.blogspot.ch 2
http://unixfreunde.de 2
http://classztoop.blogspot.com 2
http://www.netvibes.com 2
http://www.manhag.org 2
http://interactivestemlearningprogramsk-12.blogspot.ro 1
http://pcampitiello.blogspot.mx 1
More...

Accessibility

Categories

Upload Details

Uploaded via SlideShare as Adobe PDF

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel

110 of 14 previous next Post a comment

  • stryng Miguel Tavares http://ubuntuforums.org/showthread.php?p=11893791#post11893791 1 year ago
    Are you sure you want to
    Your message goes here
    Processing…
  • dilesoft Dmitry Lejkin at Пиратская Партия России mmm... chmod from c system call will not work? 2 years ago
    Are you sure you want to
    Your message goes here
    Processing…
  • rxxluowei rxxluowei mark 3 years ago
    Are you sure you want to
    Your message goes here
    Processing…
  • sac2279 sac2279 exec chmod +x chmod 3 years ago
    Are you sure you want to
    Your message goes here
    Processing…
  • stevebeattie stevebeattie On 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:

    # /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.)
    3 years ago
    Are you sure you want to
    Your message goes here
    Processing…
  • gnrfan 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.

    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.
    3 years ago
    Are you sure you want to
    Your message goes here
    Processing…
  • DustinMorro Dustin Morro Wow my brain hurts. :( 3 years ago
    Are you sure you want to
    Your message goes here
    Processing…
  • KevinBenton Kevin Benton This 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.
    3 years ago
    Are you sure you want to
    Your message goes here
    Processing…
  • AlexPilosov Alex Pilosov debugfs, change permissions in there. may need to flush things out of cache. 3 years ago
    Are you sure you want to
    Your message goes here
    Processing…
  • AlexButcher Alex Butcher A bit round about, but create a dummy file, mkdosfs it, mount it loopback, then copy the chmod binary into it. 3 years ago
    Are you sure you want to
    Your message goes here
    Processing…

110 of 14 previous next

Post Comment
Edit your comment

chmod -x chmod chmod -x chmod Presentation Transcript