Let's say user wants to execute a script test.sh but ls -l test.sh gives -rwxrwxr-- 1 root root 96 Feb 25 21:44 test.shNow if user doesn't want to make a copy of test.sh (on which he does chmod +x), he can simply dosh test.shto execute test.sh.Is there an analogue way to execute binary programs which one doesn't have execute permissions?
How to execute a file without execute permissions
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/chmodI think you can apply it to any other program that you know is executable. Otherwise be ready to embrace the disaster, which may ensuePS> /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.