Skip to content

Instantly share code, notes, and snippets.

@superjojo140
Last active September 10, 2020 09:53
Show Gist options
  • Save superjojo140/d5bd0630a1474ddcb6924463563f5ff9 to your computer and use it in GitHub Desktop.
Save superjojo140/d5bd0630a1474ddcb6924463563f5ff9 to your computer and use it in GitHub Desktop.
chmod for dummies

Using chmod...

Examples

chmod a+rwx path/to/file    # Everybody can read, write and execute the file
chmod u+rwx path/to/file    # The owner of the file can read, write and execute the file
chmod o-wx path/to/file     # All other users can no longer write or execute the file
chmod ug+x path/to/file     # The owner and the group can now execute the file

Symbolic mode

chmod USER+PERMISSIONS path/to/file

USER can be one of the following:

Usertype Character
Owner of the file u
Group of the file g
Other users o
Everybody a

PERMISSION can be one of the following:

Permission Character
Read r
Write w
Execute x

To add a permission to the specified usertype use a + as seperator between USER and PERMISSON character. In case of revoke permission use a -.

Change permissions of a whole folder

If you want to set the permissions of a folder and all containing files and folders user the -R flag

chmod -R a+r path/to/folder/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment