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

Table of Contents

Advertisement

Chapter 3. Shell Prompt Basics
In the following example, you want to allow everyone to write to the file, so they can read it, write
notes in it, and save it. That means you must change the "others" section of the file permissions.
Take a look at the file first. At the shell prompt, type:
ls -l sneakers.txt
The previous command displays this file information:
-rw-rw-r--
1 sam sam
Now, type the following:
chmod o+w sneakers.txt
The
command tells the system you want to give others write permission to the file
o+w
. To check the results, list the file's details again. Now, the file looks like this:
sneakers.txt
-rw-rw-rw-
1 sam sam
Now, everyone can read and write to the file.
To remove read and write permissions from
both the read and write permissions.
chmod go-rw sneakers.txt
By typing
, you are telling the system to remove read and write permissions for the group and
go-rw
for others from the file
The result looks like this:
-rw-------
1 sam sam
Think of these settings as a kind of shorthand when you want to change permissions with
because all you really have to do is remember a few symbols and letters with the
Here is a list of what the shorthand represents:
Identities
— the user who owns the file (that is, the owner)
u
— the group to which the user belongs
g
— others (not the owner or the owner's group)
o
— everyone or all (
a
Permissions
— read access
r
— write access
w
— execute access
x
Actions
— adds the permission
+
— removes the permission
-
— makes it the only permission
=
150 Mar 19 08:08 sneakers.txt
150 Mar 19 08:08 sneakers.txt
.
sneakers.txt
150 Mar 19 08:08 sneakers.txt
,
, and
)
u
g
o
use the
sneakers.txt
command to take away
chmod
command.
chmod
43
,
chmod

Advertisement

Table of Contents
loading

This manual is also suitable for:

Enterprise linux 3

Table of Contents