If I'm not mistaken, a lot of that can be accomplished by proper configuration of an .htaccess file if you are using Apache. However, WebDev has never been my strongest point. Regardless of whether you are running a script locally or as cgi on a web server, graff's point about file locking is very important. Any access to shared resources need to be controlled properly or you will have issues.
Comment on Re^2: Modification of files from CGI script
I'm not big into web dev either, but I've never heard of being able to control that via .htaccess before (and allowing suid to any user other than the owner of the .htaccess file to be configured that way has obvious security problems). Apache does, however, have suexec, which I believe causes scripts to run suid as their owner. AFAIK, suexec is the only way for CGI/etc. scripts to run as a user other than the apache user.