[Catalyst-dev] run as another system user

Sebastian Riedel sri at oook.de
Sat Jul 16 16:36:38 CEST 2005


Am 16.07.2005 um 12:53 schrieb chunzi:

> I am writing a webmail using Catalyst, and wanner it runging as
> 'vpopmail' user, so it can
> read or write some mail files under the Maildirs.
>
> Here is my script, is that right? at least it will print 'vpopmail'  
> when
> call system whoami in the script.
>
> BEGIN {
> $ENV{CATALYST_ENGINE} ||= 'HTTP';
> $ENV{CATALYST_SCRIPT_GEN} = 4;
> use User::pwent;
> use User::grent;
> $pw = getpwnam('vpopmail');
> $< = $> = $pw->uid();
> $( = $) = $pw->gid();
> }
>
> could catalyst support somthing like 'perl myapp_server.pl -u  
> vpopmail'
> to let it run as user 'vpopmail' ?

It could, but keep in mind that the built in server is meant mostly  
for development, for real deployment i'd only use mod_perl, FastCGI  
and the like.
Maybe it's better to have this in Catalyst::Manual::Cookbook!

To add something to the cookbook, just post it to the wiki at http:// 
dev.catalyst.perl.org , we (Jesse) will merge it in for you. ;)


--
sebastian




More information about the Catalyst-dev mailing list