University Computing Systems


cgi-bin Access for AFS Accounts


CGI Programs (scripts) on cgi.njit.edu

Note: The information on this page is intended for AFS accounts. Information on CGI programs for clubs that use /afs/cad/web/club/<clubname>/cgi-bin is here.

Users with AFS accounts can run CGI executables located in the public_html/cgi-bin subdirectory of their login directory. This service is available on cgi.njit.edu only. The URL for such executables will be of the form:
http://cgi.njit.edu/~<UCID>/cgi-bin/<script>
To enable your account for CGI, run the following program on any Solaris, IRIX, Linux, or Tru64 AFS client:

/usr/ucs/bin/cgi.setup

Allowing CGI programs to write to your account

Your CGI script cannot normally write files to your own account; i.e, to your home directory or any subdirectory. However, there is a way around this: the httpd daemon (Web server) runs under the user "cgiuser", which does not normally have write access to your home directory or any of its sub-directories. The command:

fs sa <path.to.dir> cgiuser write
will give the user cgiuser write permission in the given directory (provided you own that directory). Since cgiuser must also have at least minimum privileges along the whole path to that directory, the easiest thing to do to meet that condition is to allow cgiuser to write to a directory in your public_html tree, where cgiuser already has the needed permissions, e.g,

fs sa ~/public_html/<some.dir> cgiuser write

Debugging CGI programs

As an aid to debugging CGI programs, the portions of the Web server error logs and access logs pertaining to a given user are available for inspection by that user (only). These logs are generated every 15 minutes, and are located in:

/afs/cad/pub/cgi.logs/{error_log, access_log}/<UCID>

Make sure your scripts are executable: chnod +x <script>

Note:If your CGI script is written in Perl, use /usr/local/bin/perl, not /bin/perl or /usr/bin/perl

Users are entirely responsible for their code.


Sample Scripts

There are a few sample, working scripts in /afs/cad/pub/cgi.logs/scripts. You can copy these scripts to your cgi-bin directory and invoke them, to verify that your setup is working.

Server Side Includes (SSI)

Files with an ".shtml" extension in a user's public_html/ssi subdirectory of their login directory are processsed for Server Side Includes, with no restrictions, on cgi.njit.edu. I.e., the URL would be of the form:
http://cgi.njit.edu/~<UCID>/ssi/<filename>.shtml
To enable your account for SSI, run the following program on any Solaris, IRIX, Linux, or Tru64 AFS client:

/usr/ucs/bin/ssi.setup

NOTE!

User processes running on cgi.njit.edu are continuously monitored. Processes that consume too much resources, or otherwise significantly degrade the performance of cgi.njit.edu, will be killed. Users whose processes repeatedly degrade the performance of cgi.njit.edu, or compromise its security, will be barred from running programs on that machine.