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

Table of Contents

Advertisement

Chapter 4. Shell Prompt Basics
Now, type the following:
chmod o+w foo.txt
The
command tells the system you want to give others write permission to the file
o+w
check the results, list the file's details again. Now, the file looks like this:
-rw-rw-rw-
1 user user
Now, everyone can read and write to the file.
To remove read and write permissions from
read and write permissions.
chmod go-rw foo.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 user user
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
=
Want to test your permissions skills? Remove all permissions from
chmod a-rwx foo.txt
Now, see if you can read the file with the command
cat: foo.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:
150 Mar 19 08:08 foo.txt
.
foo.txt
150 Mar 19 08:08 foo.txt
,
, and
)
u
g
o
use the
foo.txt
chmod
cat foo.txt
command to take away both the
chmod
— for everyone.
foo.txt
, which should return the following:
67
. To
foo.txt
,
chmod
command.

Advertisement

Table of Contents
loading

This manual is also suitable for:

Enterprise linux 4

Table of Contents