Files and directories in Unix may have three kinds of permissions: read (`r"), write (`w'), and execute (`x'). Each permission can be "open" for the following three categories of users " or "off": the file or directory owner; others in the same group as the owner; and all others.
1. Documents
To change the mode of a file, use the chmod command. The general form is
chmod X @ Y file1 file2 ...
where: X is the letter "u" (for owner), "g" (for group), "o" (for others), "a" (for all; ie for " ugo"); @ is "+" to add permissions, "-" to remove permissions, or "=" to assign permissions absolutely; Y is any combination of `r', `w', `x'. Here are some examples:
chmod u=rx file (Give the owner rx permissions, not w)
chmod go-rwx file (Deny rwx permission for group, others)
chmod g+w file (Give write permission to the group)
chmod a+x file1 file2 (Give execute permission to everybody)
chmod g+rx,o+x file (OK to combine like this with a comma)
2. Directory
The above licensing scheme also applies to directories. For directories, anyone with "read" permissions can use the ls command to list files (and thus discover what files are in there); anyone with "write" permissions can create and delete files in the directory; Anyone can access a file or subdirectory with a known name.