Each file and directory belongs to a specific user ID and group ID, and has a set of permissions (also referred to as modes) associated with it.
You can use these utilities to control ownership and permissions:
To: | Use: |
---|---|
Specify the permissions for a file or directory | chmod |
Change the owner (and optionally the group) for a file or directory | chown |
Change the group for a file or directory | chgrp |
For details, see the Utilities Reference.
Permissions are divided into these categories:
Each set of permissions includes:
For example, if you list your home directory (using ls -al), you might get output like this:
total 94286 drwxr-xr-x 18 barney techies 6144 Sep 26 06:37 ./ drwxrwxr-x 3 root root 2048 Jul 15 07:09 ../ drwx------ 2 barney techies 4096 Jul 04 11:17 .AbiSuite/ -rw-rw-r-- 1 barney techies 185 Oct 27 2000 .Sig -rw------- 1 barney techies 34 Jul 05 2002 .cvspass drwxr-xr-x 2 barney techies 2048 Feb 26 2003 .ica/ -rw-rw-r-- 1 barney techies 320 Nov 11 2002 .kshrc -rw-rw-r-- 1 barney techies 0 Oct 02 11:17 .lastlogin drwxrwxr-x 3 barney techies 2048 Oct 17 2002 .mozilla/ drwxrwxr-x 11 barney techies 2048 Sep 08 09:08 .ph/ -rw-r--r-- 1 barney techies 254 Nov 11 2002 .profile drwxrwxr-x 2 barney techies 4096 Jul 04 09:06 .ws/ -rw-rw-r-- 1 barney techies 3585 Dec 05 2002 123.html
The first column is the set of permissions. A leading d indicates that the item is a directory; see "Types of files," earlier in this chapter.
You can also use octal numbers to indicate the modes; see chmod in the Utilities Reference.