Super User is a question and answer site for computer enthusiasts and power users. 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

I am trying to create an executable "Hello World" ruby file and I copied an existing, working executable "Hello World" ruby file and renamed it, but the new file does not have any executable permissions. The original file had the following permissions:

-rwxr-xr-x 1

The new file has the following permissions:

-rw-r--r-- 1

I have tried chmod -x [Filename] for the new file as well as sudo chmod, but nothing changes the file permissions. The file permissions remain:

-rw-r--r-- 1

Any attempt to execute the file understandably returns

bash: [filename]: Permission_denied

share|improve this question

migrated from Apr 10 '11 at 13:59

This question came from our site for professional and enthusiast programmers.

The file could be immutable. You can remove this attribute with chattr. The immutable attribute would also prevent the super user from modifying the file. – 0xC0000022L Apr 10 '11 at 13:58
Or the driver for the file system (eg. ntfs-3g) may not support file permissions. – K. Norbert Apr 10 '11 at 14:25

The command chmod -x [Filename] removes the executable permission from the file you are attempting to execute. If you wanted to make the file executable, you want to try something like chmod +x [Filename] (notice the + in place of minus).

share|improve this answer

You must log in to answer this question.