Home [an error occurred while processing this directive]

Home

Scripts

Support

Tutorials

Contact

Sections

Tutorials



What Is...?

What is a data directory?
A data directory is the real server path (sometimes called absolute path) to your file or folder. You don't use a URL like http://www.gwscripts.com, you should use something like these examples:

    UNIX Server:
    On a UNIX server a data directory would look something like this:
    /usr/www/roosh/html/gwscript/news

    Windows NT, 2000:
    On a windows based server a data directory would look something like this:
    c:\users\www.blizzardaddicts.com/web/news

What is #!/usr/bin/perl?
This line is only necessary if you're running on a UNIX server; it tells the server that this is a perl script/program. You will also always find this on the first line of any perl script/program. (You may need to change the path to perl depending on where your System Admin installed perl. Most of the time it will either be /usr/bin/perl or /usr/local/bin/perl.)

If you're running on a Windows NT/2k server then you don't need to include this but it does not hurt to include it. If you don't include it then it WILL NOT work on a UNIX based server!

What is CHMOD?
File permissions are set using UNIX's chmod command, the format is as follows:

    chmod [permissions] filename
    or a real example
    chmod 755 news.cgi
This is always done from the UNIX shell, TELNET or by an FTP client. Most FTP clients have a user friendly GUI interface for setting permissions. If you are doing this by hand though TELNET I would suggest going and downloading the trial version of GlobalScape's CuteFTP.

Anyway back to CHMOD. This makes alot of people confused but if you think about it, it's really not that hard. The first digit defines what permissions the owner of the file has (i.e., the person who created the file), the second dictates what permissions the group that the owner belongs to has, and the third dictates what permissions everyone else has. Each category of permission (read, write, execute) is assigned a numeric value. Read permission is 4, write permission is 2 and execute permission is 1 (execute permission means that the directory can be searched). If you want the owner of the file to have permission to read, write, execute the file then you use a 7 (4 +2 +1) for the second digit. If you want the group to have permission to read and execute only, then you use a 5 (4+1) for the third digit. An example CHMOD command that gave full permissions to the owner and read and execute permissions to the owner and the world (your visitors that will run the script).

So lets say your installing good old News Publisher and you were told you had to CHOMD the news.cgi file so that your staff and you could run the script from their web browser then you would need to type in this:

    chmod 755 news.cgi
Typically these (755) are the permission settings you will want to give to your CGI programs. (Required, template, and data files don't need to be executable, so you will use 644 with them.) You may also want to create an empty index.html file in the same directory as your CGI programs and set its permissions to 700. This will prevent people from getting access to your programs by using the url of your CGI directory.

NOTE: Don't forget to set the access permissions for any directories or subdirectories you create when setting up your program. Otherwise you will not be able to access your files properly, even if their permissions are set correctly.

By IceFire
Forum Moderator, Writer


All html and design are copyright 2000 GWScripts. All rights reserved.