| ★ wanayoo — archive 1999 http://webdeveloper.com/drweb/97Feb17-drwebsite.html | Nouvelle recherche | Portail wanayoo |
![]()
Dr. Website
How to Set Access Permissions for Files and Directories on a Site
Dear Dr. Website®: I've got some scripts that I would love to upload to my CGI subdirectory, but I'm told that I need to make sure to assign the proper permissions for the directories and for the individual files themselves. I'm not getting a lot of help from my ISP, and I haven't been able to find out any specifics about permissions. Can you point me to some kind of detailed explanation a nd a list of these permissions? You can allow or prevent access to any file or directory on your Web site by changing its access permissions. Setting file and directory permissions for Web documents is a concept borrowed directly from the Unix operating system, which has built-in file permissions.The actual steps to follow in setting these file permissions depends on how you manage the files on your Web site. If you place files on your site via FTP, for example, you can modify file permissions within many FTP software packages like WS_FTP (for Windows users) or Fetch (for the Mac).
The more traditional way to set file permissions, though, is through a command-line interface under Unix. First, you can specify three kinds of access permissions: read, write, and execute. Read permission is necessary to access a file or directory. With write permission, you can add to or delete files from a directory or modify a document. The execute permission makes directories searchable, so you can read and write files within it. Setting the execute permission lets visitors run files like scripts.
Most of the time, it makes good sense to restrict write permission on your files.
Next, you can specify these permissions for three user categories: you as the user (or owner), other users in your group, or the world (namely, anyone who comes to visit your Web site). This system can enable you to collaborate with many different users in managing a Web site safely, because you can only change the permissions for files and directories that you have the proper access for.
From the Unix command line, you can change file permissions with the chmod command, as in the following examples:
chmod 744 filename chmod 755 directorynameThe three-digit number that follows the chmod command represents the specific file permissions you're setting. The first digit represents the user category, the second the group, and the third the world. Read, write, and execute permissions have values of 4, 2, and 1, respectively. You add up these values to get the total for each of the three user categories. For example, 755 means that a file is readable, writable, and executable for you, but only readable and executable for other users. If you have only access permissions set for a file-set to 700, for example-visitors to that page on your Web site will receive an error message saying they are forbidden to access that page.Depending on what default settings apply when you upload files to your server, you may not even need to manually change permissions for your files and directories. When you're implementing scripts, however, checking file permissions for your script file and the directory it's in is an important troubleshooting step. If your script calls other files, you'll need to make sure those files are also readable and executable by the server.
You can read more about how to modify file permissions, especially when setting up a CGI script, at Selena Sol's CGI Trouble-Shooting FAQ.
Webreference.com also has a collection of pointers to Unix tutorial sites, such as UNIXhelp for Users.
Getting Stock Answers
Dear Dr. Website®: How can I get the code for putting a stock ticker on my Web page? To provide continually updating stock information on your Web page, you'll first need a client program that can capture and display this stock data at regular intervals. There are several Java applets readily available on the Web that will give you this functionality. You can visit Gamelan to find a number of these Java tickers; an explanatory description is included for each applet.You'll also need a source for supplying this stock-price data feed. There are several stock-price servers, like PC Quote and QLive, that offer licensing programs for corporate sites.
Reprinted from Web Week, Volume 3, Issue 4, February 17, 1997 © internet.com Corporation All rights reserved. Keywords: java site_management Date: 19970217
![]()