The Computer Oracle

How to add +x just for user with chmod?

--------------------------------------------------
Rise to the top 3% as a developer or hire one of them at Toptal: https://topt.al/25cXVn
--------------------------------------------------

Music by Eric Matyas
https://www.soundimage.org
Track title: Magical Minnie Puzzles

--

Chapters
00:00 How To Add +X Just For User With Chmod?
00:17 Accepted Answer Score 35
00:53 Answer 2 Score 3
01:07 Thank you

--

Full question
https://superuser.com/questions/727325/h...

--

Content licensed under CC BY-SA
https://meta.stackexchange.com/help/lice...

--

Tags
#linux #commandline #bash #chmod

#avk47



ACCEPTED ANSWER

Score 35


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.




ANSWER 2

Score 3


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.