1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142
|
.\" Copyright (c) 1983, 1991 The Regents of the University of California.
.\" All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in the
.\" documentation and/or other materials provided with the distribution.
.\" 3. All advertising materials mentioning features or use of this software
.\" must display the following acknowledgement:
.\" This product includes software developed by the University of
.\" California, Berkeley and its contributors.
.\" 4. Neither the name of the University nor the names of its contributors
.\" may be used to endorse or promote products derived from this software
.\" without specific prior written permission.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.\" @(#)setregid.2 6.4 (Berkeley) 3/10/91
.\"
.\" Modified Sat Jul 24 09:08:49 1993 by Rik Faith <faith@cs.unc.edu>
.\" Portions extracted from linux/kernel/sys.c:
.\" Copyright (C) 1991, 1992 Linus Torvalds
.\" May be distributed under the GNU General Public License
.\" Changes: 1994-07-29 by Wilf <G.Wilford@ee.surrey.ac.uk>
.\" 1994-08-02 by Wilf due to change in kernel.
.\" 2004-07-04 by aeb
.\" 2004-05-27 by Michael Kerrisk
.\"
.\" Japanese Version Copyright (c) 1997 HANATAKA Shinya
.\" all rights reserved.
.\" Translated Fri Dec 12 00:18:45 JST 1997
.\" by HANATAKA Shinya <hanataka@abyss.rim.or.jp>
.\" Updated & Modified Mon Jun 4 19:11:44 JST 2001
.\" by Yuichi SATO <ysato@h4.dion.ne.jp>
.\" Updated & Modified Wed Jan 5 00:37:49 JST 2005
.\" by Yuichi SATO <ysato444@yahoo.co.jp>
.\"
.\"WORD: effective user ID ¸桼ID
.\"WORD: real user ID ¥桼ID
.\"WORD: saved user ID ¸桼ID
.\"WORD: super-user ѡ桼
.\"
.TH SETREUID 2 2007-07-26 "Linux" "Linux Programmer's Manual"
.SH ̾
setreuid, setregid \- (real) ȼ¸ (effective) 桼 (롼) ID ꤹ
.SH
.B #include <sys/types.h>
.br
.B #include <unistd.h>
.sp
.BI "int setreuid(uid_t " ruid ", uid_t " euid );
.br
.BI "int setregid(gid_t " rgid ", gid_t " egid );
.sp
.in -4n
glibc εǽޥ
.RB ( feature_test_macros (7)
):
.in
.sp
.BR setreuid (),
.BR setregid ():
_BSD_SOURCE || _XOPEN_SOURCE\ >=\ 500
.SH
.BR setreuid ()
ϸƤӽФΥץμ (real) 桼 ID
¸ (effective) 桼 ID ꤹ롣
¥桼 ID ¸桼 ID \-1 Ϳ硢
ƥϤ ID ѹʤ
øץϼ¸桼 ID ¥桼 ID ޤϼ¸桼 ID ޤ
¸ set-user-ID ˤǤʤ
POSIX: øץ¥桼 ID ¥桼 ID ޤ
¸桼 ID ޤ¸¸桼ID Ǥ뤫ݤϡ
ꤵƤʤ
Linux: ø桼ϼ¥桼 ID ¥桼 ID ޤ
¸桼 ID ˤǤʤ
Linux: ¥桼ID ꤵ줿ꡢ¸桼ID μ¥桼ID
ۤäͤꤵ줿硢¸ set-user-ID ˤϿ¸桼ID ͤ
ꤵ롣
Ʊͤˡ
.BR setregid ()
ϸƤӽФΥץμ¥롼 ID ȼ¸롼 ID ꤷ
嵭ǡ֥桼פ֥롼ספɤؤȤΩġ
.SH ֤
0 ֤롣顼ξ \-1 ֤졢
.I errno
Ŭڤꤵ롣
.SH 顼
.TP
.B EPERM
ƤӽФΥץøʤ
(Linux Ǥ
.BR setreuid ()
ξ
.B CAP_SETUID
ѥӥƥ (capability) ʤ
.BR setregid ()
ξ
.B CAP_SETGID
ѥӥƥʤ)
ʲΤǤʤѹꤵ줿:
(i) ¸桼 (롼) ID ȼ¥桼 (롼) ID 촹롣
(ii) ͤ¾ꤹ롣
(iii) ¸桼 (롼) ID ¸ set-user-ID (¸ set-group-ID)
ͤꤹ롣
.SH
POSIX.1-2001, 4.3BSD
.RB ( setreuid ()
.BR setregid ()
ؿ 4.2BSD о줷)
.SH
¸桼 (롼) ID ¸桼 (롼) ID
ꤹ뤳ȤLinux 1.1.37 (1.1.38) ǽˤʤä
.SH Ϣ
.BR getgid (2),
.BR getuid (2),
.BR seteuid (2),
.BR setgid (2),
.BR setresuid (2),
.BR setuid (2),
.BR capabilities (7)
|