.\" 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: Fri Jul 29 10:56:01 BST 1994 by Wilf. .\" Tue Aug 2 14:56:48 BST 1994 by Wilf due to changes in kernel. .\" .\" Japanese Version Copyright (c) 1997 HANATAKA Shinya .\" all rights reserved. .\" Translated Sat Mar 1 16:43:07 JST 1997 .\" by HANATAKA Shinya .\" .\"WORD: effective group ID 実効グループID .\"WORD: real group ID 実グループID .\"WORD: saved group ID 保存グループID .\"WORD: super-user スーパー・ユーザー .\" .TH SETREGID 2 "2nd August 1994" "Linux 1.1.38" "Linux Programmer's Manual" .SH 名前 setregid, setegid \- 実(real) と 実効(effective)グループID を設定する .SH 書式 .B #include .br .B #include .sp .BI "int setregid(gid_t " rgid ", gid_t " egid ); .br .BI "int setegid(gid_t " egid ); .SH 説明 .B setregid は現在のプロセスの実(real)グループID と 実効(effective)グループID を 設定する。非特権ユーザーが実グループID を実効グループID に変化させた りできる。 Linux 1.1.38 より前は、 .B setregid や .B setegid が使用する保存(saved)グループID パラダイムは壊れている。 1.1.38 から、保存グループIDから実効グループID を設定することが 可能になった。 スーパー・ユーザーのみが他の変更ができる。 実グループID や実効グループID に \-1 を与えた場合は、 システムはその ID を変更しない。 現在(ibc-4.x.x)では、 .BI setegid( egid ) は機能的に .BI setregid( -1 , " egid" ) と等価である。 もし実グループID が変更されたり、実効グループID が前の実グループID と 異った値に設定された場合、保存グループIDには新しい実効グループIDの値が 設定される。 .SH 返り値 成功した場合、ゼロが返される。エラーの場合は \-1 が返され、 .I errno が適切に設定される。 .SH エラー .TP .TP .B EPERM 現在のプロセスがスーパー・ユーザーでなく、変更が (i) 実効グループID と 実グループID を入れ換える。 (ii) 片方の値を他方に設定する。 (iii) 実効グループID に保存グループID の値を設定する。 のいずれでもない。 .SH 準拠 BSD 4.3 ( .B setregid 関数コールは BSD 4.2 で現れた。) .SH 関連項目 .BR getgid (2), .BR setgid (2)