setuid.3

来自「<B>Digital的Unix操作系统VAX 4.2源码</B>」· 3 代码 · 共 99 行

3
99
字号
.\" SCCSID: @(#)setuid.3	8.1	9/11/90.\".TH setuid 3.SH Namesetuid, seteuid, setruid, setgid, setegid, setrgid \- set user and group ID.SH Syntax.nf.B #include <\fIsys/types.h\fP>.B #include <\fIunistd.h\fP>.PP.B setuid(\fIuid\fP).B uid_t \fIuid\fP;.B seteuid(\fIeuid\fP).B uid_t \fIeuid\fP;.B setruid(\fIruid\fP).B uid_t \fIruid\fP;.PP.B setgid(\fIgid\fP).B gid_t \fIgid\fP;.B setegid(\fIegid\fP).B gid_t \fIegid\fP;.B setrgid(\fIrgid\fP).B gid_t \fIrgid\fP;.fi.SH Description.NXR "setuid subroutine".NXR "seteuid subroutine".NXR "setruid subroutine".NXR "setgid subroutine".NXR "setegid subroutine".NXR "setrgid subroutine".NXR "real user ID" "setting".NXR "effective user ID" "setting".NXR "real group ID" "setting".NXR "effective group ID" "setting"The.PN setuidsubroutine sets both the real and effectiveuser ID of the current process to the ID specified.Likewise, the.PN setgidsubroutine sets the real and effectivegroup ID of the current process to the ID specified..PPThe.PN seteuidsubroutine sets the effective user ID of the current process,while the.PN setegidsubroutine sets the effective group ID of the current process..PPThe.PN setruidsubroutine sets the real user ID of the current process,while the.PN setrgidsubroutine sets the real group ID of the current process..PPThese calls are only permitted to the super-useror if the argument is the real or effective ID..SH Environment.PP .B POSIX.br.B SYSTEM_FIVE.brWhen your program is compiled in POSIX or System V mode the following semanticsapply when using the.PN setuidor.PN setgidfunctions:.PP If the process is the super-user the real, effective, and savedset (as described in.MS execve 2 )user/group ID are set to.I uid..PP If the process is not the super-user, but.I uidis equal to the real or the saved set user/group ID, theeffective user/group ID is set to.I uid.The real and saved set user/group ID remain unchanged..PP .B POSIX.br In POSIX mode, the.PN setuidfunction returns a value of type uid_t. The.PN setgidfunction returns a value of type gid_t..SH Return ValuesZero is returned if the user ID or group ID is set;\-1 is returned otherwise..SH See Alsosetreuid(2), setregid(2), getuid(2), getgid(2)

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?