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
|
.\" Copyright (C), 1994, Graeme W. Wilford. (Wilf.)
.\"
.\" Permission is granted to make and distribute verbatim copies of this
.\" manual provided the copyright notice and this permission notice are
.\" preserved on all copies.
.\"
.\" Permission is granted to copy and distribute modified versions of this
.\" manual under the conditions for verbatim copying, provided that the
.\" entire resulting derived work is distributed under the terms of a
.\" permission notice identical to this one
.\"
.\" Since the Linux kernel and libraries are constantly changing, this
.\" manual page may be incorrect or out-of-date. The author(s) assume no
.\" responsibility for errors or omissions, or for damages resulting from
.\" the use of the information contained herein. The author(s) may not
.\" have taken the same level of care in the production of this manual,
.\" which is licensed free of charge, as they might when working
.\" professionally.
.\"
.\" Formatted or processed versions of this manual, if unaccompanied by
.\" the source, must acknowledge the copyright and authors of this work.
.\"
.\" Fri Jul 29th 12:56:44 BST 1994 Wilf. (G.Wilford@ee.surrey.ac.uk)
.\"
.\" Traduction 15/10/1996 par Christophe Blaess (ccb@club-internet.fr)
.\" Mise a Jour 8/04/97
.TH SETGID 2 "8 Avril 1997" Linux "Manuel du programmeur Linux"
.SH NOM
setgid \- Fixer l'ID de groupe.
.SH SYNOPSIS
.B #include <unistd.h>
.sp
.BI "int setgid(gid_t " gid )
.SH DESCRIPTION
.B setgid
fixe le GID effectif du processus en cours. Si l'appelant est
le Super\-User, les GID rels et sauvs sont egalement fixs.
Sous Linux
.B setgid
est implement comme la version POSIX avec l'option _POSIX_SAVED_IDS.
Ceci permet un programme Set\-GID (autre que root) d'abandonner
tous ses privilges de groupe, d'effectuer des tches
non\-privilgies, et de retrouver son GID effectif de manire
scurise.
Si l'utilisateur est le Super\-User, ou si le programme est Set\-GID
root, des prcautions particulires doivent tre prises.
La fonction
.B setgid
vrifie le GID effectif de l'appelant et si c'est le Super\-User,
tous les GID du processus sont mis
.IR gid.
une fois ceci effectu, il est impossible au programme de retrouver
ses privilges de Super\-User.
Ainsi un programme Set\-GID root dsireux d'abandonner temporairement
ses privilges, en prenant l'identit d'un programme de groupe non-root, puis
de rcuprer ses privilges par la suite ne doit pas utiliser
.BR setgid .
On peut accomplir ceci en utilisant l'appel (non-POSIX, BSD)
.BR setegid.
.SH "VALEUR RENVOYE"
.B setgid
renvoie 0 s'il russit, ou \-1 s'il choue, auquel cas
.I errno
contient le code d'erreur.
.SH ERREURS
.TP 0.8i
.B EPERM
L'utilisateur n'est pas Super\-User et
.I gid
ne correspond ni au GID effectif, ni au GID sauv du processus.
.SH "CONFORMIT"
SVr4, SVID.
.SH "VOIR AUSSI"
.BR getgid "(2), " setregid "(2), " setegid (2)
.SH TRADUCTION
Christophe Blaess, 1997.
|