Living in the Shell #24; chmod (Modify file/directory permissions)
Babak K. Shandiz
Posted on January 6, 2023
chmod
🔐
Modifies file/directory permissions (See here or here for more details).
Permission expressions are mostly formatted as [ugoa][+-=][rwx]
:
Symbol | Meaning |
---|---|
r |
Read |
w |
Write |
x |
Execute |
Symbol | Meaning |
---|---|
u |
User (owner of the file/directory) |
g |
Group (of the file/directory) |
o |
Other users/groups |
a |
All users/groups |
Grant all permissions to everyone; a+rwx
or 777
chmod a+rwx some-file
# or
chmod 777 some-file
Make a file executable for everyone +x
chmod +x some-file
# or
chmod a+x some-file
Make a file executable only for the User (owner) u+x
chmod u+x some-file
Disallow Group and Others to read/write/execute go-rwx
chmod go-rwx some-file
Apply the same User (owner) permissions to the Group =u
chmod g=u some-file
Rewrite permissions for the Group and Others =
chmod go=rw some-file
Clear permissions for the Group and Others =
chmod go= some-file
Clear all permissions =
chmod a= some-file
About Living in the Shell
Obsessed with doing things in the shell, I’ve decided to share my daily struggles on living in the shell as terse but informative posts.
💖 💪 🙅 🚩
Babak K. Shandiz
Posted on January 6, 2023
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.