in reply to Re: how to switch user
in thread how to switch user

I'm not sure I understand your solution. If your script is running as root, chances are good that $UID and $EUID are already zero so your assignment won't do anything. Did you want to say something like this instead?
unless ($UID) { $EUID = $unpriviledged_uid; $EGID = $unpriviledged_gid; } ...

Note that setting $EUID lets you act like the user, but on AIX at least it doesn't prevent you (or a child process you spawn) from resetting this back to zero and becomming root again, which can have security implications if you really want to run a child process unpriviledged. You can try setting $UID directly, but that isn't supported on some systems (e.g. AIX again).

bluto