How to execute a file without execute permissions
Basically this is the same thing as one of the very famous UNIX technical interview questions, known for ages:
Assume someone with root access ran a command chmod -R 444 /
and made the chmod
binary non-executable. How do you recover from it ?
There is a perl answer and there is this one, which basically is running a non-executable program, chmod
in this case:
/lib/ld-linux.so /bin/chmod +x /bin/chmod
I think you can apply it to any other program that you know is executable. Otherwise be ready to embrace the disaster, which may ensue
PS> /lib/ld-linux.so
might differ in name. So if the direct match is not available, look around for similarly named so
's. For instance on my CentOS 6 server, it is /lib/ld-linux.so.2
which is a symlink pointing to /lib/ld-2.12.so
. So, your mileage may vary.