# PXFSETUID (L*X, M*X)

POSIX Subroutine: Sets the effective user ID of the current process.

## Module

USE IFPOSIX

CALL PXFSETUID (iuid,ierror)

iuid | (Output) INTEGER(4). The session ID.
ierror | (Output) INTEGER(4). The user status.

If successful, ierror is set to zero; otherwise, an error code.

If the effective user ID of the caller is root, the real and saved user ID's are also set. This feature allows a program other than root to drop all of its user privileges, do some un-privileged work, and then re-engage the original effective user ID in a secure manner.

### CAUTION

If the user is root then special care must be taken. PXFSETUID checks the effective uid of the caller. If it is the superuser, all process-related user ID's are set to uid. After this has occurred, it is impossible for the program to regain root privileges.

Parent topic: POSIX* Library Routines

## See Also

PXFGETUID