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

chmod +x file changes a file from rw-r--r-- to rwxr-x-r-x but really I only wanted rwx-r--r-- is this possible?

share|improve this question
You'd be much more likely to get a good answer on Unix/Linux SE – evamvid Mar 11 '14 at 0:58
chmod u+x file. u=user, g=group, o=others. – jweyrich Mar 11 '14 at 1:15
@jweyrich put that as an answer -- that's more elegant and better than my way... – evamvid Mar 11 '14 at 1:17
The question probably has dozens of duplicates, but I posted it as an answer anyway. Glad it helped. – jweyrich Mar 11 '14 at 1:38
@evamvid this question is perfectly on topic here, no reason to suggest the OP take it to Unix & Linux. And I say that as a regular of both sites. – terdon Mar 11 '14 at 5:52
up vote 19 down vote accepted

To change only the permission for the current user, you can use:

chmod u+x <file>

Where u=user, g=group, o=others.

If you want to enforce the permissions you mentioned, this would be the ideal:

chmod u=rwx,go=r file

Optionally, you can do the same using the octal notation, as follows:

chmod 744 <file>

This will set rwx (the 7) for user, and r (the 4's) for group and others.

share|improve this answer

Try running chmod u=rwx,go=r file.

In my case, that gives the permissions as rwx-r--r--, which I think is what you meant.

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .