in reply to Running a perl script with root, changing to another user and then back to root?

Maybe setting the EUID (Effective User Id) is enough for your purposes: check $> documentation in perlvar.

Update: Though, note that you can do that only when the code running with the EUID changed is controlled by you and safe. Otherwise, it could be made to change the EUID again in order to execute arbitrary code as root.

  • Comment on Re: Running a perl script with root, changing to another user and then back to root?
  • Download Code