Scroll to navigation

SETGID(2) Manual del Programador de Linux SETGID(2)

NOMBRE

setgid - establece la identidad de grupo

SINOPSIS

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

int setgid(gid_t gid);

DESCRIPCIÓN

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.

Bajo Linux, setgid() está implementada como la versión POSIX con la característica _POSIX_SAVED_IDS. Esto permite que un programa SGID (distinto de root) renuncie a todos sus privilegios de grupos, haga algún trabajo no privilegiado, y luego recupere su ID de grupo efectivo original de una manera segura.

VALOR DEVUELTO

En caso de éxito se devuelve cero. En caso de error se devuelve -1, y errno se configura adecuadamente.

ERRORES

The group ID specified in gid is not valid in this user namespace.
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.

CONFORME A

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

NOTAS

The original Linux setgid() system call supported only 16-bit group IDs. Subsequently, Linux 2.4 added setgid32() supporting 32-bit IDs. The glibc setgid() wrapper function transparently deals with the variation across kernel versions.

Diferencias núcleo / biblioteca C

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).

VÉASE TAMBIÉN

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

COLOFÓN

Esta página es parte de la versión 5.10 del proyecto Linux man-pages. Puede encontrar una descripción del proyecto, información sobre cómo informar errores y la última versión de esta página en https://www.kernel.org/doc/man-pages/.

TRADUCCIÓN

La traducción al español de esta página del manual fue creada por Gerardo Aburruzaga García <gerardo.aburruzaga@uca.es>, Juan Piernas <piernas@ditec.um.es> y Miguel Pérez Ibars <mpi79470@alu.um.es>

Esta traducción es documentación libre; lea la GNU General Public License Version 3 o posterior con respecto a las condiciones de copyright. No existe NINGUNA RESPONSABILIDAD.

Si encuentra algún error en la traducción de esta página del manual, envíe un correo electrónico a debian-l10n-spanish@lists.debian.org.

6 Marzo 2019 Linux