The important thing to know about UNIX permissions is this: each file is "owned" by a user and not every user can access every file. Not too hard, eh? However, this is a big departure from the world of Dos, Windows 98, or MAC where there might have been different "users" on the machine but everyone could access every file. The only difference between these "users" was what desktop theme that got loaded. Unix is different. It was designed to be a multi-user system where security is important. More about users and permissions Each web hosting account that we setup at DRH has its own unix user. This is the username that you specified when the account was setup and that you connect with using FTP. Each file that you create is owned as your user, and has specific permissions on what you and other users in the system can do with it. By default, your files are created so that you can read and write them, but everyone else can just read them. There are three "rights" that can be granted for each file: the right to "read" a file, to "write" a file, and to "execute" a file (if it is a program). Each of these rights can be granted to the "user" (that's you, the owner of the file), the "group" (that's everyone else on the system, we don't use groups) and "other" (that's also everyone else on the system). When you are logged in via telnet and use the "dir" command, you see a symbolic representation of the permissions of each file. (These representations of the permissions have been bolded below.)
For the first file, index.html, you can see from the red rw- letters that the file can be read ("r") and written ("w") by the user. The blue r-- shows that the group can only read ("r") the file. And the green r-- shows that everyone else ("other") can only read ("r") the file. Basically each grantee ("user", "group", or "other") has three letters that show what accesses they were granted: "r" for read, "w" for write, and "x" for execute. If the grantee was not granted that access a dash is shown.
It then follows that for the second file, whois.cgi, you
can see that
You should also be able to recognize the following permissions:
When do I use this?
Normally you don't have to bother at all with permissions. The default of
"everyone can read, but only I can write"
(
When you have a CGI script you must specify that it can be executed by granting
everyone execute permission
( Permissions mainly come into play when you use CGI scripts. The next section explains this. Permissions and CGI scripts There are two important things to know about permissions and CGI scripts.
First, the CGI script must be set so that it can be executed. Do this by granting everyone execute permission
( The second thing to know is that, by default, the CGI script does not run as your username so it can't modify your files. Many CGI scripts need to modify a file on your system, such as a guestbook program which stores user information in a file. By default a CGI script can't do this because the CGI script runs as another user and that user does not have write permission on your files (unless you explicitly give it).
There are two ways to enable a CGI script to be able to modify your files: (1) make the CGI script
run as your username by renaming it from ".cgi" to
".cgi-set", or (2) give everyone permission to modify the
file that needs to be modified by the CGI script, by setting the permissions to
The second option is not secure, since anyone can modify that file. We recommend you use option one.
For more information about the .cgi-set extension, see the following page
in the support library: How to modify permissions Modify permissions of files from telnet using the chmod command.
The chmod command is called with an octal number which represents the permissions to be set and then a list
of files to change. This looks like Here is a lookup table for the common permissions to their octal codes:
Learn more about the chmod command by typing "man chmod" at a telnet prompt for the manual page.
|
|||||||||||||||||||||