.\" -*- coding: UTF-8 -*- .\" Copyright (c) 1983, 1991 The Regents of the University of California. .\" and Copyright (C) 2009, 2010, 2014, 2015, Michael Kerrisk .\" All rights reserved. .\" .\" %%%LICENSE_START(BSD_4_CLAUSE_UCB) .\" 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. .\" %%%LICENSE_END .\" .\" @(#)setregid.2 6.4 (Berkeley) 3/10/91 .\" .\" Modified Sat Jul 24 09:08:49 1993 by Rik Faith .\" 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 .\" 1994-08-02 by Wilf due to change in kernel. .\" 2004-07-04 by aeb .\" 2004-05-27 by Michael Kerrisk .\" .\"******************************************************************* .\" .\" This file was generated with po4a. Translate the source file. .\" .\"******************************************************************* .TH SETREUID 2 "15 septembre 2017" Linux "Manuel du programmeur Linux" .SH NOM setreuid, setregid \- Définir les UID et GID effectifs et/ou réels .SH SYNOPSIS \fB#include \fP .br \fB#include \fP .PP \fBint setreuid(uid_t \fP\fIruid\fP\fB, uid_t \fP\fIeuid\fP\fB);\fP .br \fBint setregid(gid_t \fP\fIrgid\fP\fB, gid_t \fP\fIegid\fP\fB);\fP .PP .RS -4 Exigences de macros de test de fonctionnalités pour la glibc (consulter \fBfeature_test_macros\fP(7))\ : .RE .PP \fBsetreuid\fP(), \fBsetregid\fP()\ : .RS 4 .ad l .\" || _XOPEN_SOURCE\ &&\ _XOPEN_SOURCE_EXTENDED _XOPEN_SOURCE\ >=\ 500 || /* Since glibc 2.19: */ _DEFAULT_SOURCE || /* Glibc versions <= 2.19: */ _BSD_SOURCE .ad .RE .SH DESCRIPTION \fBsetreuid\fP() définit les ID d'utilisateur effectif et réel du processus appelant. .PP Fournir une valeur \-1 pour l'un des arguments demande au système de ne pas modifier l'ID correspondant .PP Les processus non privilégiés peuvent seulement définir leur UID effectif à la valeur de l'UID réel, de l'UID effectif ou de l'UID sauvé. .PP Les utilisateurs non privilégiés peuvent seulement définir l'UID réel à la valeur de l'UID réel ou de l'UID effectif. .PP Si l'UID réel est changé (c'est\-à\-dire si \fIruid\fP est différent de \-1), ou si l'UID effectif a avec une valeur différente de l'UID réel précédent, le set\-uid sauvegardé prendra également la valeur du nouvel UID effectif. .PP De manière analogue, \fBsetregid\fP() définit les ID de groupe du processus appelant, et toutes les remarques précédentes s'appliquent, en remplaçant GID par UID. .SH "VALEUR RENVOYÉE" En cas de succès, zéro est renvoyé. En cas d'erreur, \fB\-1\fP est renvoyé et \fIerrno\fP reçoit une valeur adéquate. .PP \fINote\fP\ : dans certains cas, \fBsetreuid\fP() peut échouer alors même que l'UID de l'appelant est 0\ ; ne pas vérifier la valeur renvoyée par \fBsetreuid\fP() pour détecter un échec est une grave erreur qui compromet la sécurité du système. .SH ERREURS .TP \fBEAGAIN\fP L'appel a changé l'identifiant (UID) réel de l'appelant (c'est à dire que \fIruid\fP ne correspond pas à l'UID réel de l'appelant), mais une erreur temporaire est survenue lors de l'allocation des structures de données du noyau nécessaires à l'opération. .TP \fBEAGAIN\fP \fIruid\fP ne correspond pas à l'UID réel de l'appelant et suite à cet appel, le nombre de processus appartenant à l'utilisateur dont l'identifiant réel est \fIruid\fP a dépassé la limite de ressources \fBRLIMIT_NPROC\fP de l'appelant. A partir de Linux 3.1, cette erreur ne peut plus se produire (néanmoins, les applications sérieuses doivent vérifier que l'erreur ne s'est pas produite)\ ; consultez la description de \fBEAGAIN\fP dans \fBexecve\fP(2). .TP \fBEINVAL\fP Au moins un des identifiants utilisateur ou groupe cible n'est pas valide dans espace de noms utilisateur. .TP \fBEPERM\fP The calling process is not privileged (on Linux, does not have the necessary capability in its user namespace: \fBCAP_SETUID\fP in the case of \fBsetreuid\fP(), or \fBCAP_SETGID\fP in the case of \fBsetregid\fP()) and a change other than (i) swapping the effective user (group) ID with the real user (group) ID, or (ii) setting one to the value of the other or (iii) setting the effective user (group) ID to the value of the saved set\-user\-ID (saved set\-group\-ID) was specified. .SH CONFORMITÉ POSIX.1\-2001, POSIX.1\-2008, 4.3BSD (\fBsetreuid\fP() and \fBsetregid\fP() first appeared in 4.2BSD). .SH NOTES Définir l'UID (GID) effectif avec la valeur de l'UID (GID) sauvé est possible depuis Linux 1.1.37 (1.1.38). .PP POSIX.1 does not specify all of the UID changes that Linux permits for an unprivileged process. For \fBsetreuid\fP(), the effective user ID can be made the same as the real user ID or the saved set\-user\-ID, and it is unspecified whether unprivileged processes may set the real user ID to the real user ID, the effective user ID, or the saved set\-user\-ID. For \fBsetregid\fP(), the real group ID can be changed to the value of the saved set\-group\-ID, and the effective group ID can be changed to the value of the real group ID or the saved set\-group\-ID. The precise details of what ID changes are permitted vary across implementations. .PP POSIX.1 ne dit rien de l'effet de ces appels sur les set\-user\-ID et set\-group\-ID sauvés. .PP .\" Les appels système \fBsetreuid\fP() et \fBsetregid\fP() originaux de Linux ne géraient que des identifiants d'utilisateur et de groupe sur 16\ bits. En conséquence, Linux\ 2.4 a ajouté \fBsetreuid32\fP() et \fBsetregid32\fP() qui prennent en charge des identifiants 32\ bits. Les fonctions \fBsetreuid\fP() et \fBsetregid\fP() de la glibc qui les encapsulent gèrent de manière transparente ces différences entre noyaux. .SS "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 those for \fBsetreuid\fP() and \fBsetregid\fP()) 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 \fBnptl\fP(7). .SH "VOIR AUSSI" \fBgetgid\fP(2), \fBgetuid\fP(2), \fBseteuid\fP(2), \fBsetgid\fP(2), \fBsetresuid\fP(2), \fBsetuid\fP(2), \fBcapabilities\fP(7), \fBcredentials\fP(7), \fBuser_namespaces\fP(7) .SH COLOPHON Cette page fait partie de la publication\ 5.10 du projet \fIman\-pages\fP 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/. .SH TRADUCTION La traduction française de cette page de manuel a été créée par Christophe Blaess , Stéphan Rafin , Thierry Vignaud , François Micaux, Alain Portal , Jean-Philippe Guérard , Jean-Luc Coulon (f5ibh) , Julien Cristau , Thomas Huriaux , Nicolas François , Florentin Duneau , Simon Paillard , Denis Barbier , David Prévot , Cédric Boutillier et Frédéric Hantrais . Cette traduction est une documentation libre ; veuillez vous reporter à la .UR https://www.gnu.org/licenses/gpl-3.0.html GNU General Public License version 3 .UE 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 à .MT debian-l10n-french@lists.debian.org .ME .