views:

468

answers:

2

I created a server program that will be started as root. After it is started I want to drop privileges to another user. How can I do this securely?

+9  A: 

See Privileges::Drop.

Benji York
I used this module. It seems to work ok. Thank you.
Peter Stuifzand
+5  A: 

You don't really need a module, although the one linked by Benji York looks pretty nice.

It's a simple matter of setting the UID via $< and $>. See perlvar for further information on these. You can also set the GID this way using $( and $).

jettero
Don't forget $( and $).
Chas. Owens
good point. I imagined he'd just use the drop priv module, and there's really no reason not to, or I'd have provided an example. It would look much like the source for the module though.
jettero