4.1 chmod permission specifications

chmod accepts a variety of methods to specify permissions of a file or directory. The most commonly used notation is also used by several other commands, such as ls.

Execute the following command (anywhere in the file system):

ls -l -d  
    

This is the “long” form of ls, which displays some properties related to a file. In this case, the ls command displays properties of the current working directory itself.

You should see something like this:

drwxr-x--x 16 user1 group1 20480 2009-03-01 10:23 .  
    

The first part of this line indicates the permissions. This is a 10-character sequence that is divided into 4 main portions:

The most intuitive method to change the permissions of a file is to use the “symbolic” method. For example, to remove “read” access to a file from the group owner, use the following command:

chmod g-r file  
    

Or, you can add execution permission to all users to a file using the following command:

chmod a+x file  
    

The a ownership is an abbreviation of “all”, including the user owner, the group owner and others.