Example uses of the command "chmod"

An Introductory Tutorial

Man using computer
Comstock Images/Stockbyte/Getty Images

With the chmod command you can change the access permissions of files and folders. For example if you want to change the permissions of the file "participants" so that everybody has full access to it, you would enter:

chmod 777 participants
The first 7 sets the permissions for the user, the second 7 sets the permissions for the group, and the third 7 sets the permissions for everybody else, who has access to this computer.
If you want to be the only one who can access it, you would use:
chmod 700 participants
To give yourself and your goup members full acces, you use:
chmod 770 participants
If you want to keep full access for yourself, but want to keep other people from modifying the file, you can use:
chmod 755 participants
The 5 allows "read" and "execute" permissions, but not "write" permissions. A 6 would allow read and write permissions, but not "execute". A 4 would be "read" only. A 2 would be "write" only, and a 1 would be "execute" only.

You can change the group ownership of existing files and folders with the command chgrp.

You can change the default group for new files and folders with the command newgrp.

More From Us