5.L.2: Changing File Permissions | 5: Managing Files and Directories | 5.L: Controlling Access to Your Files and Directories |
Before you get yourself into trouble by changing file permissions, you need to know what they are and what they do. You start by looking at a long listing (ll) in your home directory:
> cd ~
> ls -l
> ll
The result of either of these "long lists" should be something like:
-rw-r--r-- 1 melanie users 3197 May 17 14:29 Mwm -rw-r--r-- 1 melanie users 12983 May 17 14:29 README.first -rwxr-xr-x 1 melanie users 28784 May 17 14:29 a.out* drwxr-xr-x 4 melanie users 512 May 17 14:31 development/ -rw-r--r-- 1 melanie users 1840 May 17 14:29 eqns2.ms -rw-r--r-- 1 melanie users 3923 Jul 28 10:18 plotoutfile.ps drwxr-xr-x 3 melanie users 512 Aug 4 16:03 public-html/ -rw-r--r-- 1 melanie users 19917 May 17 14:29 s2 -rw-r--r-- 1 melanie users 133 Sep 1 18:02 sample.docHere the first column contains 10 characters (d's, r's, w's, x's, and "-"'s) which are code to indicate the file mode. The first character in the code indicates the file type. A "-" indicates an ordinary file and a "d" a directory.
The next nine characters (r's, w's, x's and "-"'s) are actually three sets of three characters each. An "r" indicates read permission, a "w" write (change or delete) permission, and an "x" execute permission. A "-" indicates the absence of a character, and so would mean you cannot read, write, or execute that file.
The first set of characters gives the permissions of the "owner", the second set gives the permissions of the "group", and the third set gives the permissions of "all others".
For the listing we give, melanie is the owner as is indicated in the third column. (You should be the owner in the listing the computer