Installation guide
122 Chapter 11. Shell Prompt Basics
chmod 644 sneakers.txt
Now verify the changes by listing the file. Type:
ls -l
sneakers.txt
The output should be:
-rw-r--r-- 1 sam sam 150 Mar 19 08:08 sneakers.txt
Now, neither the group nor others have write permission to sneakers.txt. To return the group’s
write access for the file, add the value of w (2) to the second set of permissions.
chmod 664 sneakers.txt
Warning
Setting permissions to 666 will allow 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:
• -rw------- (600) — Only the owner has read and write permissions.
• -rw-r--r-- (644) — Only the owner has read and write permissions; the group and others have
read only.
• -rwx------ (700) — Only the owner has read, write and execute permissions.
• -rwxr-xr-x (755) — The owner has read, write and execute permissions; the group and others
have only read and execute.
• -rwx--x--x (711) — The owner has read, write and execute permissions; the group and others
have only execute.
• -rw-rw-rw- (666) — Everyone can read and write to the file. (Be careful with these permissions.)
• -rwxrwxrwx (777) — Everyone can read, write, and execute. (Again, this permissions setting can
be hazardous.)
Here are some common settings for directories:
• drwx------ (700) — Only the user can read, write in this directory.
• drwxr-xr-x (755) — Everyone can read the directory, but its contents can only be changed by the
user.