Support Topics: PERL: User's Guide: About File and Folder permissions
Since our servers either emulate UNIX, or are a variant of UNIX
(like Mac OS X is) each file and folder on the server has permission
settings that say what type of user can do what with that file
or folder. In the case of your web page files and images the permissions
are automatically set to allow everybody to read them, otherwise
nobody would be able to see your website, and for you (the "owner")
to write them, otherwise you would not be able to make changes
to your website. For Perl scripts, and files that are modified
by them, the permissions are a little more complex.
File/Folder permissions are broken down into
three types of users, "Owner", "Group", and
"Everybody Else" (sometimes called "World")
and each one of those types has three different permissions that
can be granted, "Read", "Write", and "Execute".
"Owner" is you, "Group" can be an association
of several owners (other users on the system) and "Everybody
Else", is everybody else (usually visitors to your website).
In the case of our system "Group" is not used.
In the case of files, "Read" means
that file can be read, "Write" means that the file can
be written to (changed), and "Execute" means that the
file can be executed or "ran" (applies only to Perl
scripts)
In the case of folders the permissions mean
something a little different; "Read" means that files
in that directory can be listed, "Write" means that
files in that directory can be deleted or created, and "Execute"
means that the user can "cd" (change to that directory
from another one).
Permissions are listed like this:
Owner |
Group |
Everybody Else |
Read, Write, Execute |
Read, Write, Execute |
Read, Write, Execute |
and placed from left to right:
Owner |
Group |
Everybody Else |
rwx |
rwx |
rwx |
For example:
-rw-r--r-- 1 bob ftpguest 173 Jul 31 16:55 test.html
The file "test.html" can be read and
written by the Owner, in this case "bob", and only read
by Group (called "ftpguest"), and read by Everybody
Else. This is the standard permissions settings for most files
in your web site (web pages, graphics, etc.). It allows visitors
to your web site to read the file, but only the Owner can modify
it.
drwxr-xr-x 2 bob ftpguest 1024 Jan 23 2001 guestbook
The directory (folder) called "guestbook"(indicated
by the "d" next to the permissions) can be read, written
& executed by the Owner, read & executed by Group, and
read & executed by Everybody Else. These are standard permissions
for most folders in your website. It allows visitors to your website
the proper access to view the web pages you have in that folder,
but allows only you, the "Owner", to delete and create
files in that folder.
-rwxr-xr-x 1 bob ftpguest 2689 Mar 21 13:44
counter.pl
The Perl script called "counter.pl"
(a hit counter script that keeps track of the number of people
accessing a page) can be read, written & executed by Owner,
read & executed by Group, and read & executed by Everybody
Else. This is the standard permissions settings for most Perl
scripts in your web site. It allows visitors to your web site
to read and execute the file, but only the Owner can modify it.
If a Perl script is not executable by Everybody it will not work
at all.
-rw-rw-rw- 1 bob ftpguest 15 Mar 21 13:45 counter.dat
The text file called "counter.dat" can be read &
written by Owner, read & written by Group, and read &
written by Everybody Else. In this case, this file is used by
the above mentioned "counter.pl" to store data (the
number of times the page has been hit), so it needs to be writeable
by Everybody. If it was not writeable by everybody chances are
the"counter.pl" script would not work properly as it
could not add data to the file. This is the standard permissions
settings for most files that Perl scripts need to write to. Note
that even though this file is writeable by everybody, the only
way it can be modified is if they have FTP access to your directory
(unlikely), or through the use of "counter.pl" which
only allows certain things to be done according to the script
(for example: add "1" to the counter value stored in
the file).
|