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
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 -
.
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/