Scroll to navigation

SETGID(2) Manuel du programmeur Linux SETGID(2)

NOM

setgid - Définir l'identifiant de groupe

SYNOPSIS

#include <sys/types.h>
#include <unistd.h>

int setgid(gid_t gid);

DESCRIPTION

setgid() sets the effective group ID of the calling process. If the calling process is privileged (more precisely: has the CAP_SETGID capability in its user namespace), the real GID and saved set-group-ID are also set.

Sous Linux setgid() est implémenté comme la version POSIX avec l'option _POSIX_SAVED_IDS. Ceci permet à un programme Set-GID (autre que root) d'abandonner tous ses privilèges de groupe, d'effectuer des tâches non privilégiées, et de retrouver son GID effectif de manière sécurisée.

VALEUR RENVOYÉE

En cas de succès, zéro est renvoyé. En cas d'erreur, -1 est renvoyé et errno reçoit une valeur adéquate.

ERREURS

EINVAL
L'identifiant de groupe indiqué dans gid n'est pas valide dans cet espace de noms utilisateur.
EPERM
The calling process is not privileged (does not have the CAP_SETGID capability in its user namespace), and gid does not match the real group ID or saved set-group-ID of the calling process.

CONFORMITÉ

POSIX.1-2001, POSIX.1-2008, SVr4.

NOTES

L'appel système setgid() original de Linux ne gérait que des identifiants de groupe sur 16 bits. En conséquence, Linux 2.4 a ajouté setgid32() qui prend en charge des identifiants 32 bits. La fonction setgid() de la glibc qui l'encapsule gère de manière transparente ces différences entre noyaux.

différences entre bibliothèque C et noyau

At the kernel level, user IDs and group IDs are a per-thread attribute. However, POSIX requires that all threads in a process share the same credentials. The NPTL threading implementation handles the POSIX requirements by providing wrapper functions for the various system calls that change process UIDs and GIDs. These wrapper functions (including the one for setgid()) employ a signal-based technique to ensure that when one thread changes credentials, all of the other threads in the process also change their credentials. For details, see nptl(7).

VOIR AUSSI

getgid(2), setegid(2), setregid(2), capabilities(7), credentials(7), user_namespaces(7)

COLOPHON

Cette page fait partie de la publication 5.04 du projet man-pages Linux. Une description du projet et des instructions pour signaler des anomalies et la dernière version de cette page peuvent être trouvées à l'adresse https://www.kernel.org/doc/man-pages/.

TRADUCTION

La traduction française de cette page de manuel a été créée par Christophe Blaess <https://www.blaess.fr/christophe/>, Stéphan Rafin <stephan.rafin@laposte.net>, Thierry Vignaud <tvignaud@mandriva.com>, François Micaux, Alain Portal <aportal@univ-montp2.fr>, Jean-Philippe Guérard <fevrier@tigreraye.org>, Jean-Luc Coulon (f5ibh) <jean-luc.coulon@wanadoo.fr>, Julien Cristau <jcristau@debian.org>, Thomas Huriaux <thomas.huriaux@gmail.com>, Nicolas François <nicolas.francois@centraliens.net>, Florentin Duneau <fduneau@gmail.com>, Simon Paillard <simon.paillard@resel.enst-bretagne.fr>, Denis Barbier <barbier@debian.org>, David Prévot <david@tilapin.org>, Cédric Boutillier <cedric.boutillier@gmail.com> et Frédéric Hantrais <fhantrais@gmail.com>

Cette traduction est une documentation libre ; veuillez vous reporter à la GNU General Public License version 3 concernant les conditions de copie et de distribution. Il n'y a aucune RESPONSABILITÉ LÉGALE.

Si vous découvrez un bogue dans la traduction de cette page de manuel, veuillez envoyer un message à debian-l10n-french@lists.debian.org.

6 mars 2019 Linux