for 20 years I have used chmod 755, 644, 777 ...,
and each time I had to think the number in binary
mode to understand if that bit was up or down.
Some years ago, I have discovered, there was from ever,
but I did not know, a way more clear to use chmod:
chmod a+rx file // in the examples above.
You can think the command in "relative mode" instead absolute.
When you say chmod 755, you give the permissions
indipendentely from the previous; many times this is useful.
Other times you want add or revoke permissions for someone.
The syntax is
chmod {what} +|- {what}
{what} can be a combination of
u=user(owner), g=group, o=other, or simply a=all
+|- : + to add, - to revoke
{what} can be a combination of r,w,x
EG:
chmod ug+x file.exe
add executable bit to owner and group. Or
chmod a-w *
protects all file for modify for everyone (also owner)
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.