Red Hat ENTERPRISE LINUX 3 - STEP BY STEP GUIDE Manual page 58

Table of Contents

Advertisement

44
Want to test your permissions skills? Remove all permissions from
chmod a-rwx sneakers.txt
Now, see if you can read the file with the command
following:
cat: sneakers.txt: Permission denied
Removing all permissions, including your own, successfully locked the file. But since the file belongs
to you, you can always change its permissions back with the following command:
chmod u+rw sneakers.txt
Use the command
cat sneakers.txt
Here are some common examples of settings that can be used with
— adds write access for the group
g+w
— removes all permissions for others
o-rwx
— allows the file owner to execute the file
u+x
— allows everyone to read and write to the file
a+rw
— allows the owner and group to read the file
ug+r
— allows only the group to read and execute (not write)
g=rx
By adding the
option, you can change permissions for entire directory trees.
-R
Because you can not really "execute" a directory as you would an application, when you add (or
remove) the execute permission for a directory, you are really allowing (or denying) permission to
search through that directory.
For instance, if you do not allow others to have the execute permission on the
does not matter who has read or write access. No one can access the directory unless they know the
exact file name.
For example, type
chmod a-x tigger
to remove everyone's execute permissions.
Here is what happens when you try to change directories using the
moving everyone's execute permissions:
bash: tigger: Permission denied
Next, restore your own and your group's access:
chmod ug+x tigger
If you check your work with
directory.
to verify that you, the file owner, can read the file again.
, you can see that only others are denied access to the
ls -l
Chapter 3. Shell Prompt Basics
sneakers.txt
cat sneakers.txt
:
chmod
cd tigger
— for everyone.
, which should return the
directory, it
/tigger/
command after re-
/tigger/

Advertisement

Table of Contents
loading

This manual is also suitable for:

Enterprise linux 3

Table of Contents