Red Hat ENTERPRISE LINUX 4 - STEP BY STEP GUIDE Manual page 83

Table of Contents

Advertisement

Chapter 4. Shell Prompt Basics
Each permission setting can be represented by a numerical value:
r = 4
w = 2
x = 1
- = 0
When these values are added together, the total is used to set specific permissions. For example, if you
want read and write permissions, you would have a value of 6; 4 (read) + 2 (write) = 6.
For
, here are the numerical permissions settings:
foo.txt
-
(rw-)
(rw-)
The total for the user is six(4+2+0), the total for the group is six(4+2+0), and the total for others is
four(4+0+0). The permissions setting is read as
If you want to change
file, remove the access by subtracting two (2) from that set of numbers.
The numerical values then become six, four, and four (644).
To implement these new settings, type:
chmod 644 foo.txt
Now verify the changes by listing the file. Type:
ls -l foo.txt
The output should be:
-rw-r--r--
1 user user
Now, neither the group nor others have write permission to
access for the file, add the value of w (2) to the second set of permissions.
chmod 664 foo.txt
Warning
Setting permissions to 666 allows everyone to read and write to a file or directory. Setting permis-
sions to 777 allows everyone read, write, and execute permission. These permissions could allow
tampering with sensitive files, so in general, it is not a good idea to use these settings.
Here is a list of some common settings, numerical values and their meanings:
Setting
-rw-------
-rw-r--r--
(r--)
so those in your group do not have write access, but can still read the
foo.txt
150 Mar 19 08:08 foo.txt
Numerical
Meaning
(600)
Only the owner has read and write permissions.
(644)
Only the owner has read and write permissions; the group
and others have read only.
.
664
foo.txt
. To return the group's write
69

Advertisement

Table of Contents
loading

This manual is also suitable for:

Enterprise linux 4

Table of Contents