Hallo, dies ist ein Test.
PWD: /www/data-lst1/unixsoft/unixsoft/kaempfer/.public_html
Running in File Mode
Relative path: ./../../../../../../usr/man/man2/setuid.2
Real path: /usr/share/man/man2/setuid.2
Zurück
'\" te .\" Copyright (c) 2003, 2023, Oracle and/or its affiliates. .\" Copyright (c) 1989, AT&T. All rights reserved. .TH setuid 2 "30 Jan 2023" "Oracle Solaris 11.4" "System Calls" .SH NAME setuid, setegid, seteuid, setgid \- set user and group IDs .SH SYNOPSIS .LP .nf #include <sys/types.h> #include <unistd.h> \fBint\fR \fBsetuid\fR(\fBuid_t\fR \fIuid\fR); .fi .LP .nf \fBint\fR \fBsetgid\fR(\fBgid_t\fR \fIgid\fR); .fi .LP .nf \fBint\fR \fBseteuid\fR(\fBuid_t\fR \fIeuid\fR); .fi .LP .nf \fBint\fR \fBsetegid\fR(\fBgid_t\fR \fIegid\fR); .fi .SH DESCRIPTION .sp .LP The \fBsetuid()\fR function sets the real user ID, effective user ID, and saved user ID of the calling process. The \fBsetgid()\fR function sets the real group ID, effective group ID, and saved group ID of the calling process. The \fBsetegid()\fR and \fBseteuid()\fR functions set the effective group and user IDs respectively for the calling process. See \fBIntro\fR(2) for more information on real, effective, and saved user and group IDs. .sp .LP At login time, the real user ID, effective user ID, and saved user ID of the login process are set to the login ID of the user responsible for the creation of the process. The same is true for the real, effective, and saved group IDs; they are set to the group ID of the user responsible for the creation of the process. .sp .LP When a process calls one of the \fBexec\fR(2) or \fBspawn\fR(2) family of functions to execute a file (program), the user and/or group identifiers associated with the process can change. If the file executed is a set-user-ID file, the effective and saved user IDs of the process are set to the owner of the file executed. If the file executed is a set-group-ID file, the effective and saved group IDs of the process are set to the group of the file executed. If the file executed is not a set-user-ID or set-group-ID file, the effective user \fBID\fR, saved user ID, effective group ID, and saved group ID are not changed. .sp .LP If the {\fBPRIV_PROC_SETID\fR} privilege is asserted in the effective set of the process calling \fBsetuid()\fR, the real, effective, and saved user IDs are set to the \fIuid\fR argument. If the \fIuid\fR argument is 0 and none of the saved, effective, or real UID is 0, additional restrictions apply. See \fBprivileges\fR(7). .sp .LP If the {\fBPRIV_PROC_SETID\fR} privilege is not asserted in the effective set, but \fIuid\fR is either the real user ID or the saved user ID of the calling process, the effective user ID is set to \fIuid\fR. .sp .LP If the {\fBPRIV_PROC_SETID\fR} privilege is asserted in the effective set of the process calling \fBsetgid()\fR, the real, effective, and saved group IDs are set to the \fIgid\fR argument. .sp .LP If the {\fBPRIV_PROC_SETID\fR} privilege is not asserted in the effective set, but \fIgid\fR is either the real group ID or the saved group ID of the calling process, the effective group ID is set to \fIgid\fR. .SH RETURN VALUES .sp .LP Upon successful completion, \fB0\fR is returned. Otherwise, \fB\(mi1\fR is returned and \fBerrno\fR is set to indicate the error. .SH ERRORS .sp .LP The \fBsetuid()\fR and \fBsetgid()\fR functions will fail if: .sp .ne 2 .mk .na \fB\fBEINVAL\fR\fR .ad .RS 10n .rt The value of \fIuid\fR or \fIgid\fR is out of range. .RE .sp .ne 2 .mk .na \fB\fBEPERM\fR\fR .ad .RS 10n .rt For \fBsetuid()\fR and \fBseteuid()\fR, the {\fBPRIV_PROC_SETID\fR} privilege is not asserted in the effective set of the calling process and the \fIuid\fR argument does not match either the real or saved user IDs, or an attempt is made to change to UID 0 and none of the existing UIDs is 0, in which case additional privileges are required. .sp For \fBsetgid()\fR and \fBsetegid()\fR, the {\fBPRIV_PROC_SETID\fR} privilege is not asserted in the effective set and the \fIgid\fR argument does not match either the real or saved group IDs. .RE .SH ATTRIBUTES .sp .LP See \fBattributes\fR(7) for descriptions of the following attributes: .sp .TS tab( ) box; cw(2.75i) |cw(2.75i) lw(2.75i) |lw(2.75i) . ATTRIBUTE TYPE ATTRIBUTE VALUE _ Interface Stability Committed _ MT-Level Async-Signal-Safe _ Standard See \fBstandards\fR(7). .TE .sp .SH SEE ALSO .sp .LP \fBIntro\fR(2), \fBexec\fR(2), \fBgetgroups\fR(2), \fBgetuid\fR(2), \fBissetugid\fR(2), \fBsetreuid\fR(2), \fBspawn\fR(2), \fBstat.h\fR(3HEAD), \fBattributes\fR(7), \fBprivileges\fR(7), \fBstandards\fR(7) .SH HISTORY .sp .LP These functions have been included in all Sun and Oracle releases of Solaris.