changing permissions in order to write a file in Mod_perl

[prev] [thread] [next] [Date index for 2005/04/29]

From: angie ahl
Subject: changing permissions in order to write a file in Mod_perl
Date: 13:48 on 29 Apr 2005
I'm sending this question to the beginners perl list and the mod_perl
list as I'm not sure where it belongs.

In short: I'm trying to work out how to create a directory/file under
a specific user.

This is running on MP2 on Apache2 with suexec enabled. The vhost has:

=09SuexecUserGroup myuser myuser

When trying to create the file I get a permissions error.

I'm trying to create folders and files in the public_html folder who's
perms are:
drwxr-x---  4 myuser  apache   512 Apr 29 11:31 public_html


The uid and gid for the folder:
public_html: uid =3D 1009, gid =3D 1003

the perl scripts (module that's a handler in fact) uid and gid:
Real: uid =3D 1004, gid =3D 1003 1003 1003=20
Effective: uid =3D 1004, gid =3D 674124656 1003 1003=20


The control Panel (Direct Admin) created the public_html folder under
group apache, so I assume all sites will be created with that folder
under group apache.

Other files/folders created via ftp/file upload are user and group myuser.

So I'd like to be able to create folders and files under user/group
myuser and not havae to create them under group apache. so that site's
don't have access to each others files.

So it seems my mod_perl modules are running under a different user
than the suexec setting in httpd.conf

Do I have to open up the permissions (ie make group apache writeable
for the folder) or is there some way I can temoprarily switch to uid
1009, make my files, and then switch back to 1004. Or would this be a
really bad (crossing the beams kind of bad).

TIA

changing permissions in order to write a file in Mod_perl
angie ahl 13:48 on 29 Apr 2005

Generated at 10:25 on 04 May 2005 by mariachi v0.52