Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

After compiling a C program on Ubuntu 10.10, after executing chmod +x ./a.out, I am still getting bash: ./a.out: Permission denied. How can I run my new executable?

share|improve this question
2  
Are you the owner of the file? You're not building as root, are you (using sudo, etc)? – Marty Fried Jul 8 '12 at 20:16

One possible reason is that you are compiling on a file system that has been mounted with the noexec option.

Run mount -l to see the options that file systems are mounted with.

share|improve this answer

If you are compiling the program and running the executable file on an external drive or something similar, move the file to Desktop and recompile and run it there.

share|improve this answer
1  
Welcome to Ask Ubuntu! As a famous philosopher once said "Do, or do not! There is no try!" or in Ask Ubuntu style: if you're sure, then it's an answer, if you're not, then it's a comment. Words like "try" "might", "should" are a sign, that a message belongs in the comments, and "do", "will", "shall" in answers. – Videonauth Jun 19 at 10:51
    
Thanks for the advise – DTA Jun 20 at 7:38

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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