Installation guide
120 Chapter 11. Shell Prompt Basics
[sam@halloween sam]$ cat sneakers.txt
cat: sneakers.txt: Permission denied
[sam@halloween sam]$
Removing all permissions, including your own, successfully locked the file. But since the file belongs
to you, you can always change its permissions back (see Figure 11-11).
[sam@halloween sam]$ chmod u+rw sneakers.txt
[sam@halloween sam]$ cat sneakers.txt
buy some sneakers
then go to the coffee shop
then buy some coffee
bring the coffee home
take off shoes
put on sneakers
make some coffee
relax!
[sam@halloween sam]$
Figure 11-11. Removing and Restoring Permissions
Here are some common examples of settings that can be used with chmod:
• g+w — adds write access for the group
• o-rwx — removes all permissions for others
• u+x — allows the file owner to execute the file
• a+rw — allows everyone to read and write to the file
• ug+r — allows the owner and group to read the file
• g=rx — lets the group only read and execute (not write)
By adding the -R option, you can change permissions for entire directory trees.
Because you can not really "execute" a directory as you would an application, when you add or remove
execute permission for a directory, you are really allowing (or denying) permission to search through
that directory.
To allow everyone read and write access to every file in the example directory tigger, type:
chmod -R a+rw tigger