简体   繁体   中英

How can I drop privileges in Perl?

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?

请参见Privileges :: Drop

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 $) ; note that you need to set $) = "$target_gid $target_gid" if you want to drop supplemental groups. Don't forget to test for success afterwards.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM