3 ms·
Fun trivia: so is /lib/ld-*.so*. I busted that out in an interview at a FAANG when the question was "how could you recover from accidentally running 'chmod a-x
by kstrauser 2y ago
Fun trivia: so is /lib/ld-*.so*. I busted that out in an interview at a FAANG when the question was "how could you recover from accidentally running 'chmod a-x /bin/*'"? My answer: '/lib/ld.so /bin/chmod a+x /bin/*'. The interviewer paused to get out his laptop and confirm it because he had never heard of it. After a fun detour of geeking out over something new an interesting, the followup question was modified to "How else would you do it?"
It's spelled "/lib/ld-linux-aarch64.so.1" on my nearest Linux box but is still executable today.
- mandarax8 2y agoWhat was the solution he was looking for?
- Filligree 2y agoThere’s a couple. One would be to run a Python interpreter and fix it with that.
- zbentley 2y agoHow would you launch the python interpreter if its binary is missing execute permissions?
- t-3 2y agoIn the unlikely case that you actually have a static sbin and not just a symlink you could hack together a one-liner using file or objdump to check headers and set correct perms... but considering that everything in the dir should be either an executable or a directory, chmod a+x would work just as well. If /usr/bin isn't a symlink to /bin or vice-versa, then you should have tools there to do the same thing. If you somehow still have a working C compiler (or access to another language that can do syscalls or has C bindings), it's pretty easy to write a wrapper for the syscall. If there's an rsync daemon, nfs share, etc. running, you can copy over a static busybox and fix the system that way. If you're allowed to take the system down, it's really easy - just boot up a live image and change the permissions.
- Filligree 2y ago> If you're allowed to take the system down, it's really easy - just boot up a live image and change the permissions. Having held a couple interviews like this, if you suggest taking the system down, I'll tell you that would work -- now tell me another way to do it. It's still a plus that you suggested it, even if it isn't enough of an answer on its own.
- t-3 2y agoI thought of another thing: many desktop systems have automount daemons, so USB could also be used to transfer over a busybox in that case.
- deleted 2y ago[deleted]