I was testing the GNU assembler using intermediate code generated by gcc. I don't really understand the GNU assembly syntax at all, though I could learn it at some point. I ran the command as hello.s and then as hello.s -o hello. When I ran the executable, it said "Permission denied". Even when I tried to run it as root I still got the same message. I ran ls -l to check the file permissions and the permission bits are normal (rw-r--r--). What is going on here, and how can I fix this problem?

  • 1
    chmod +x hello – PSkocik Nov 14 '15 at 20:07
  • 2
    Oh god, why didn't I think of that? – Zen Hacker Nov 14 '15 at 20:09

When you compile a source code file, the newly generated output binary file has the permissions rw-r--r-- and is not executable, since there are no x in the string.

Make it executable by running

chmod +x hello

preceed the command with sudo if needed. After that, run the binary with ./hello.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.