Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

setgid(2) [hpux man page]

setuid(2)							System Calls Manual							 setuid(2)

NAME
setuid(), setgid() - set user and group IDs SYNOPSIS
DESCRIPTION
sets the real-user-ID (ruid), effective-user-ID (euid), and/or saved-user-ID (suid) of the calling process. If the Security Containment product is installed, these interfaces treat a process observing as a privileged process. Otherwise, only processes with an euid of zero are treated as privileged processes. See privileges(5) for more information on Security Containment and fine-grained privileges. The following conditions govern setuid's behavior: o If the process is privileged, sets the ruid, euid, and suid to uid. o If the process is not privileged and the argument uid is equal to the ruid or the suid, sets the euid to uid; the ruid and suid remain unchanged. (If a set-user-ID program is not running as superuser, it can change its euid to match its ruid and reset itself to the previous euid value.) o If the process is not privileged, the argument uid is equal to the euid, and the calling process has the privilege, sets the ruid to uid; the euid and suid remain unchanged. sets the real-group-ID (rgid), effective-group-ID (egid), and/or saved-group-ID (sgid) of the calling process. The following conditions govern behavior: o If the process is privileged, sets the rgid and egid to gid. o If the process is not privileged and the argument gid is equal to the rgid or the sgid, sets the egid to gid; the rgid and sgid remain unchanged. o If the process is not privileged, the argument gid is equal to the egid, and the calling process has the privilege, sets the rgid to gid; the egid and sgid remain unchanged. Security Restrictions Some or all of the actions associated with this system call require the privilege. Processes owned by the superuser have this privilege. Processes owned by other users may have this privilege, depending on system configuration. See privileges(5) for more information about privileged access on systems that support fine-grained privileges. RETURN VALUE
Upon successful completion, and return 0; otherwise, they return -1 and set to indicate the error. ERRORS
and fail and return -1 if any of the following conditions are encountered: None of the conditions above are met. uid (gid) is not a valid user (group) ID. WARNINGS
It is recommended that the capability be avoided, as it is provided for backward compatibility. This feature may be modified or dropped from future HP-UX releases. When changing the real user ID and real group ID, use of and (see setresuid(2)) is recommended instead. AUTHOR
was developed by AT&T, the University of California, Berkeley, and HP. was developed by AT&T. SEE ALSO
exec(2), getuid(2), setresuid(2), privileges(5). STANDARDS CONFORMANCE
setuid(2)

Check Out this Related Man Page

setregid(2)							System Calls Manual						       setregid(2)

NAME
setregid - sets the real and effective group IDs SYNOPSIS
DESCRIPTION
sets the real and effective group IDs of the calling process. Only a privileged process can set the real group ID and/or the effective group ID to any valid value. A nonprivileged process can set the real group ID to the saved set-group-ID from one of the exec family of functions, or the effective group ID to either the saved set-group- ID or the real group ID. Any supplementary group IDs of the calling process remain unchanged. Argument rgid is the read group ID value to be set with. If rgid is set to the real group ID is not be changed. Argument egid is the effective group ID value to be set with. If egid is set to -1, the effective group ID is not changed. The real and effective group IDs may be set to different values in the same call. Security Restrictions Some or all of the actions associated with this system call require the privilege (CHSUBJIDENT). Processes owned by the superuser will have this privilege. Processes owned by other users may have this privilege, depending on system configuration. See privileges(5) for more information about privileged access on systems that support fine-grained privileges. RETURN VALUE
Upon successful completion is set to Otherwise, errno is set to indicate the type of error and neither group IDs are changed. ERRORS
is set to one of the following values if the corresponding condition is detected. The value of the rgid or egid argument is invalid or out-of-range. The process does NOT have all the appropriate privileges other than to change the real group ID to the saved set-group-ID, or to change the effective group ID to either the real group ID or the saved set-group-ID. AUTHOR
was developed by the University of California, Berkeley and HP. SEE ALSO
exec(2), geteuid(2), getgid(2), getuid(2), setegid(2), setgid(2), setreuid(2), setuid(2). setregid(2)
Man Page