Changing the Permissions of a File

To change the access mode of any file you own, use the chmod ("change mode") tool. It takes two arguments: an operation, which specifies the permissions to grant or revoke for certain users, and the names of the files to work on.

To build an operation, first specify the category or categories of users as a combination of the following characters:


u The user who owns the file.
g All other members of the file's group.
o All other users on the system.
a All users on the system; this is the same as `ugo'.

Follow this with the operator denoting the action to take:


+ Add permissions to the user's existing permissions.
Remove permissions from the user's existing permissions.
= Make these the only permissions the user has for this file.

Finally, specify the permissions themselves:


r Set read permission.
w Set write permission.
x Set execute permission.

For example, use `u+w' to add write permission to the existing permissions for the user who owns the file, and use `a+rw' to add both read and write permissions to the existing permissions of all users. (You could also use `ugo+rw' instead of `a+rw'.)

Posted on: 16/12/2009

If you want to leave a comment please Login or Register
How to backup your data using rsync......
Understanding autoconf......
The Basics of fdisk......
Accessing Memory Using DMA......
The fd Directory......