The UID & EUID in CGI Programs

Gene Michael Stover's

Tuesday, 20 August 2002

On Unix-like systems, what are the user & group while a CGI program runs when that CGI program's set-uid bit is enabled? Let's use a C program, a Perl program, & a Bourne shell program to see.

Why three different programs? In case one of the runtimes treats set-uid programs differently. Naturally, the C runtime treats set-uid programs exactly as Unix treats them because it uses the system calls directly. The Bourne shell most likely does that, too. The Perl runtime might do something special with set-uid Perl programs.


Copyright (c) 2002 by Gene Michael Stover. Permission to copy, store, transmit, and view this document unmodified and in its entirety is granted. All other rights are reserved.

$Header: /home/gene/library/website/docsrc/show-uid/RCS/index.html,v 395.1 2008/04/20 17:25:50 gene Exp $