next up previous contents
Next: Groups Up: Files & Directories Previous: Hidden files

Access permissions

As we have learnt previously all files have a set of access permissions. Every file is given the user's standard access permissions when it is created. The standard access permissions are set by the umask command:

$umask
077
$

The standard access permissions are expressed as a 9 bit octal number. As this is not very intuitive we can ask for a symbolic outputgif:

$umask -S
u=rwx,g=,o=
$

There are access permissions for the user who will own the new file ( u), other users in the file's group ( g) and other users not in the file's group ( o).

There are three types of permission which can be given:

In our case the umask means: Do not give group members or others any access, but give the user access for reading and writing for files and reading, writing and accessing for directories.

Permissions can be either set in addition to the existing permissions ( +) or removed ( -).

Say we want to give all group members read access to our newly created files:

$umask g+r
$umask -S
u=rwx,g=r,o=
$

To change permissions on already existing files we use the chmodgif command. The access permissions of existing files are expressed as 12 bit octal numbers, as they contain more information than the standard access permissions. The chmod command can take either a four-digit octal number or a symbolic description of the access permissions. On how to use the octal numbers please refer to appendix gif.

Whose access is changed is set by 'u' for user, 'g' for group, 'o' for others and 'a' for all simoultaneously.

Permissions can be either set in addition to the existing permissions ( +) or removed ( -). Additionally the access permissions can be set to only the permissions given on the command line ( =).

The following permissions can be given:

The general syntax for the chmod command is chmod permissions[,permissions] file [file]. So we can set multiple permissions for multiple files. Additionally we can specify the -R flag before the permissions and a directory name as file to apply the permissions the the directory and all files and directories beneath it.

Say we want to change the permissions of a file to allow group read access:

$ls -l a
-rw-------   2 markst   staff           0 Jan 21 17:13 a
$chmod g+r a
$ls -l a
-rw-r-----   2 markst   staff           0 Jan 21 17:13 a
$



next up previous contents
Next: Groups Up: Files & Directories Previous: Hidden files



Mark O. Stitson
Wed Sep 25 10:45:32 BST 1996