You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by Robert Landrum <rl...@capitoladvantage.com> on 2002/01/21 20:48:01 UTC

Re: [OT] Cgi permission Questions

At 12:26 PM -0700 1/21/02, Joe Bifano wrote:
>Hi all,
>
>My first time on the list.  I have been looking at the archives but am not
>able to find anything on this.
>
>I have 3 web servers, 1 development/nfs server and 2 database mysql servers
>in a cluster server farm.  All sites are owned by our company so nobody will
>be on the system except for me.  It is behind a firewall and a load-balancer
>so it is pretty secure.
>
>I have several domains set up on the site called test.company.com,
>demo.company.com, stage.company.com and company.com.  company.com is only on
>the 3 web servers and all the rest is on the development server.
>
>I have 2 employees that will be setting up a couple of things using a cgi
>script called create.pl on test.company.com.  When this script is run it has
>to create new test companies or demo companies.
>
>Here is the problem:  create.pl is owned by test and group test and has file
>permissions 755.  When the create.pl script is run it becomes owner apache
>and group apache and has to create new files and directories on the machine.
>All of the new files and directories  then become owner apache and group
>apace.  I need them to stay as owner test and group test.


This is a little bit offtopic, since it about permissions and not 
really about mod_perl, but here goes:

You want to use the build-in perl function chown.

chown((getpwname('test'))[2,3],@files_to_chown);

You should not have to suexec if the files you're attempting to chown 
are owned by apache/apache.

Rob


--
When I used a Mac, they laughed because I had no command prompt. When 
I used Linux, they laughed because I had no GUI.