Every Unix file also has a set of access permissions. The ls -lg command also shows these access permissions. Here is an example of one line of output from ls -lg:
-rwxrw-r-- 1 kmsalem prof 1155 Sep 27 1993 writer
This file (writer) is owned by kmsalem and its group is prof. The 10 characters at the far left describe the access permissions of the file. The first (leftmost) character is - if the file is a regular file, and d if the file is a directory. writer is a regular file. The remaining 9 characters are interpreted in groups of three. The first group of three describes the access permissions of the owner of the file, the next group of three describes the access permissions for members of the file's group, and the last group of three describes the access permissions for everyone else.
There are three characters in each group because there are three types of permissions one can have for a file: read permission, write permission, and execute permission. You need read permission to read a file, write permission to change a file, and execute permission to execute a file (if it is an executable program). In the example above, the owner of the file has all three permissions. The members of the file's group have read and write permissions but not execute permissions. Everyone else has only read permission on the file.
chmod g+r fileadds read permission for members of the file's group
chmod o+w fileadds write permission for everyone else (o = others)
chmod o-r fileremoves read permission for everyone else
chmod u-x fileremoves execute permission for the owner(u = user/owner)
Continuing with the example, if kmsalem were to run the command chmod o-r writer and then ls -lg, the result should something like the following:
-rwxrw---- 1 kmsalem prof 1155 Sep 27 1993 writer
chmod cs350 writer
-rwxrw---- 1 kmsalem cs350 1155 Sep 27 1993 writer