Reputation: 4600
I have compiled a program from my Ububtu 10.10 terminal by
gcc file_name.c -o new_file
command. It compiled successfully creating an executable file named new_file. But when I was trying to execute it by this command
./new_file
It says that permission is denied of new_file. I've checked the permission properties of that file found that I've permission to read & write it (I'm the only user of that system). Can you please help me to figure out the problem?
Upvotes: 7
Views: 39403
Reputation: 29912
You have to give it exe. permissions.
So: chmod +x new_file
When you create a new file with your gcc, by default, this isn't executable. So, you have to gave it permissions of execution.
With chmod
(see this) you change permissions on file.
In that specific case, you gave execution permissions ( + [plus] means gave, 'x' means execution ) to that file.
If you want to revoke that permission, you can type: chmod -x filename
Upvotes: 12