CGI Programming on the World Wide Web

Previous Chapter 12
Debugging and Testing CGI Applications
Next
 

12.6 Set UID/GID Wrapper

Now that we have a debugging/lint tool for CGI programs, how do we set this up so that it executes as the same UID as that of the Web server? If the Web server runs with your own UID, then you do not have to do anything. But, if it runs as some other UID, say "nobody" or "www," then you have to ask the system administrator to run a script called wrapper, which sets the UID/GID bits. Let's quickly look at this script.

The wrapper is based on a program in the book Programming Perl by Larry Wall and Randal Schwartz (two of the most knowledgable Perl gurus around). Here is the format for the wrapper command:

% wrapper -f /usr/local/bin/CGI_Lint -u nobody -g none

The -f switch specifies the filename to use, while the -u and the -g switches set the UID and GID, respectively. You could also use numerical identification numbers:

% wrapper -f /usr/local/bin/CGI_Lint -u 628120 -g 120

This will create a C executable with the specified UID and GID bits set, that will, in turn, run the CGI script.


Previous Home Next
CGI Lint--A Debugging/Testing Tool Book Index Perl CGI Programming FAQ

HTML: The Definitive Guide CGI Programming JavaScript: The Definitive Guide Programming Perl WebMaster in a Nutshell
Hosted by uCoz