Installation guide
Chapter 11. Shell Prompt Basics 119
Figure 11-10. Changing Permissions for sneakers.txt
To remove read and write permissions from sneakers.txt use the chmod command to take away
both the read and write permissions.
chmod go-rw sneakers.txt
By typing go-rw, you are telling the system to remove read and write permissions for the group and
for others from the file sneakers.txt.
The result will look like this:
-rw------- 1 sam sam 150 Mar 19 08:08 sneakers.txt
Think of these settings as a kind of shorthand when you want to change permissions with chmod,
because all you really have to do is remember a few symbols and letters with the chmod command.
Here is a list of what the shorthand represents:
Identities
u — the user who owns the file (that is, the owner)
g — the group to which the user belongs
o — others (not the owner or the owner’s group)
a — everyone or all (u, g, and o)
Permissions
r — read access
w — write access
x — execute access
Actions
+ — adds the permission
- — removes the permission
= — makes it the only permission
Want to test your permissions skills? Remove all permissions from sneakers.txt — for everyone.
chmod a-rwx sneakers.txt
Now, see if you can read the file: