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?
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
.
chmod +x hello
– PSkocik Nov 14 '15 at 20:07