next up previous contents
Next: Compiling and Running C Up: File and Directory Manipulation Previous: Commands to manipulate a

Commands to set the access permissions for files and directories

IRIX provides us a method to define the access privileges for users other than the owner of the file or directory. Normally, owner of the file or directory is the user who actually creates a file or directory by logging into his own account.

Let us assume that the user account matnajx has created a C source file example.c, on cheetah. Following operations can be performed on this file:

  1. A file can be modified by changing its contents. This operation is known as write operation. (Deletion is a special write operation in which all the contents of the file are destroyed.)
  2. A file can simply be read without changing any contents. This is known as the read operation.
  3. A file can be executed (if it is indeed an executable file).

The access privileges for a file can be set by the command chmod access_bits file_name Where access_bits can be the octal digits LMN (L, M, N can be from 0 to 7)

L: specifies Access privileges for the owner
M: specifies Access privileges for the users of the same group as the owner
N: specifies Access privileges for all the other users

Every digit L, M or N can specify following types of permissions:
0 : Neither read nor write nor execute
1 : Only execute
2 : Only write
3 : Only write and execute
4 : Only read
5 : Only read and execute
6 : Only read and write
7 : All the three privileges

For example, the command chmod 775 example.c sets the following privileges for example.c.


next up previous contents
Next: Compiling and Running C Up: File and Directory Manipulation Previous: Commands to manipulate a

Sushil Prasad
Fri Oct 9 10:28:36 EDT 1998