Server Info
Domains
Mail
Passwords
Permissions
Pathnames
Majordomo
MIME
Counter
Password Protected Web Directories
Main Menu
     

File Permissions

One of the more confusing things for the aspiring web publisher is file permissions. It is important to understand the differences, because things could not work properly otherwise.

The best way to explain this is with an example, so lets look at our bcpub.com/rtfm directory and the permissions there. To see the permissions you must type ls -lsa.

1 drwxrwxr-x 4 bryan bryan 1024 Dec 31 23:08 .
1 drwxr-xr-x 7 bcpub bryan 1024 Dec 18 02:51 ..
1 drw-rw-r-- 2 bcpub bryan 1024 Jan 1 18:21 info
2 -rwxrwxr-x 1 bcpub bryan 1091 Jan 1 18:37 manual.cgi
1 drw-rw-r-- 2 bcpub bryan 1024 Jan 1 19:14 menu
permissions owner group last modified filename
-rwx rwx rwx = -rwxrwxrwx
owner group public

Each file has three seperate permission areas that you can assign. Each area also has three options of security. The three areas are owner, group, and public and the three options for each area are r-read, w-write, and x-execute. The listing in the directory also follows the owner,group,public scheme. So -rwxrwxrwx means that anyone can read, write, or execute the file but -rwxr-xr-x means that only the owner can do all three, the group and public can only read or execute the file.

So with our directory listing above we see a file and several directories.
1 drwxrwxr-x 4 bcpub bryan 1024 Dec 31 23:08 .
1 drwxr-xr-x 7 bcpub bryan 1024 Dec 18 02:51 ..
1 drw-rw-r-- 2 bcpub bryan 1024 Jan 1 18:21 info
2 -rwxrwxr-x 1 bcpub bryan 1091 Jan 1 18:37 manual.cgi
1 drw-rw-r-- 2 bcpub bryan 1024 Jan 1 19:14 menu
permissions owner group last modified filename

In the permissions section you can tell which listings are really directories by the d in front of all the permissions. So we have four directories and one file in this directory. The file is called

manual.cgi

and the four directories are .
..
info
menu

Looking at the file we see the following line.

2 -rwxrwxr-x 1 bcpub bryan 1091 Jan 1 18:37 manual.cgi
permissions owner group last modified filename

This line tells us the following,
the permission scheme, 2 -rwxrwxr-x
the owner of the file, 1 bcpub
the group assigned to the file, bryan
the last time the file was modified, 1091 Jan 1 18:37
and the name of the file itself, manual.cgi

From the permission scheme we see that both the owner and the group can read, write and execute manual.cgi and the public can only read and execute the file.

With that all clear, you have to know how to assign those security options to the file. For this you need to understand the chmod command. The chmod command stands for change mode and has the following sytax

chmod area +/- permission file.ext
or with all the options
chmod ugoa +/- rwx file.ext

The options for the area are

u = the file's user (or owner)
g = the file's group
o = others (or public)
a = the user, the group, and others.

The +/- stands for

+ = assign this permission
- = take away this permission

And the rwx is

r = read access
w = write access
x = executable access

Well on to some examples.

chmod a+x = let everyone execute the file
chmod go-w = the group and public have no permission to write to the file
chmod g+rw = people in the group can read and write to the file