You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by jonathan vanasco <jv...@mastersofbranding.com> on 2005/03/07 02:04:22 UTC

Specifying File Permissions for Apache/MP2 created files

I can't seem to find this in the books or online docs

All files seem to be created 600 owned by the Apache user/group - which 
is a little annoying for me

is there a setting available?


Re: Specifying File Permissions for Apache/MP2 created files

Posted by jonathan vanasco <jv...@mastersofbranding.com>.
Just setting a simple umask did do the trick for 90% of my needs

I'm stuck  on one issue though --

     $req = Apache::Request->new($r);
     $upload = $req->upload("foo");
     $upload->link('/path/to/file');

no matter what or when I set the umask, file permissions are unix 600

I say 'when', because I have tried setting the umask when i call the 
link, on the customer handler, and on the startup.pl script that 
httpd.conf calls to preload modules (i kept adding umasks at different 
points to see if it needed to be set before the module got called for 
the first time)

Does anyone have a suggestion?




On Mar 8, 2005, at 12:46 AM, Stas Bekman wrote:
> I see. In which case it has nothing to do in particular with modperl. 
> It's the same with any perl script you run from the command line. It 
> creates the files with the ownership/perms of the user you run the 
> script with... unless you change that with umask as others have 
> suggested.


Re: Specifying File Permissions for Apache/MP2 created files

Posted by Stas Bekman <st...@stason.org>.
jonathan vanasco wrote:
> 
> This was in reference to :
> 
> case a)
>   open FILE , ">/path/to/file";
[...]
> right now i just umask before the file creation each time, and that 
> works,  but like everyone else here, i want what  works best

I see. In which case it has nothing to do in particular with modperl. It's 
the same with any perl script you run from the command line. It creates 
the files with the ownership/perms of the user you run the script with... 
unless you change that with umask as others have suggested.

-- 
__________________________________________________________________
Stas Bekman            JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/     mod_perl Guide ---> http://perl.apache.org
mailto:stas@stason.org http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com

Re: Specifying File Permissions for Apache/MP2 created files

Posted by jonathan vanasco <jv...@mastersofbranding.com>.
This was in reference to :

case a)
   open FILE , ">/path/to/file";
   print FILE "";
   close FILE;

case b)
   $upload = $apr->upload("identifier");
   $upload->link("/path/to/file");

I'm sure  there are other cases, such as

In any event:
	 files are created oct(600)	
	directories are created oct(766) (using mkdir or &File::Path::mkpath)

file creation perms can be changed  easily via umask()

however,
	a_ is there a setting to change the default umask behavior in apache 
or mod_perl (ie in httpd.conf)
	b_ is there an accepted 'best practice' to change default umask  
behavior

right now i just umask before the file creation each time, and that 
works,  but like everyone else here, i want what  works best


On Mar 8, 2005, at 12:24 AM, Stas Bekman wrote:
> Could you please be more specific, jonathan? What 'all files' are you 
> talking about?


Re: Specifying File Permissions for Apache/MP2 created files

Posted by Stas Bekman <st...@stason.org>.
jonathan vanasco wrote:
> I can't seem to find this in the books or online docs
> 
> All files seem to be created 600 owned by the Apache user/group - which 
> is a little annoying for me
> 
> is there a setting available?

Could you please be more specific, jonathan? What 'all files' are you 
talking about?

mod_perl (in fact Apache-Test) only changes the ownership of files under t 
when you run the test suite as root (so Apache can access those files). 
But none of these is installed during 'make install'.

ExtUtils::MakeMaker installs the files first in blib/ and then at the 
final destination, but it does so as the 'user' you've run 'perl 
Makefile.PL' with. And it always uses 600, this is the same for any perl 
module you download from CPAN. Of course if you run the build as the 
Apache user/group you will get that user as the owner of those files.

So I'm not what other files you are talking about.

-- 
__________________________________________________________________
Stas Bekman            JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/     mod_perl Guide ---> http://perl.apache.org
mailto:stas@stason.org http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com

Re: Specifying File Permissions for Apache/MP2 created files

Posted by jonathan vanasco <jv...@mastersofbranding.com>.
It should -- but a lot of other 'environments' /  'frameworks' have 
"ideal"  ways to set it.

for instance the Exim MTA will let you hardcode it  into the binary as 
a global value, or set it in certain places  for different behavior

I'm wondering if  mod_perl  has a similar mechanism


On Mar 7, 2005, at 4:53 AM, Tom Schindl wrote:

> Doesn't that depend on the umask set for the user?


Re: Specifying File Permissions for Apache/MP2 created files

Posted by Tom Schindl <to...@gmx.at>.
Doesn't that depend on the umask set for the user?

Tom

jonathan vanasco wrote:
> I can't seem to find this in the books or online docs
> 
> All files seem to be created 600 owned by the Apache user/group - which 
> is a little annoying for me
> 
> is there a setting available?
> 
>