How to add +x just for user with chmod?

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?


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.


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.