8

Dropping privileges from perl script?

view full story
linux-howto

http://stackoverflow.com – I have a perl script running as root, and from within it I want to execute a system command bar as a lesser priveleged user foo. So I have my system call wrapped as follows: sub dosys { system(@_) == 0 or die "system @_ failed: $?"; } And so I want to say: as user foo dosys("bar") Is there a mechanism within perl or the underlying bash shell that I can use to do this? (I would prefer one that didn't require installing an additional cpan library if possible) (HowTos)