.\" 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. .\" Changes inspired by patch from Richard Kettlewell .\" , aeb 970616. .\" Translated into Spanish Wed Jan 28 1998 by Gerardo Aburruzaga .\" García .\" .TH SETUID 2 "16 Junio 1997" "Linux 1.1.36" "Manual del Programador de Linux" .SH NOMBRE setuid \- establece la identidad del usuario .SH SINOPSIS .B #include .br .B #include .sp .BI "int setuid(uid_t " uid ); .SH DESCRIPCIÓN .B setuid establece el UID efectivo del proceso en curso. Si el UID efectivo de quien llama a esta rutina es root, también se establecen los identificadores de usuario real y salvado. .PP Bajo Linux, .B setuid está implementado como la versión POSIX con la característica _POSIX_SAVED_IDS. Esto permite que un programa SUID (distinto de root) renuncie a todos sus privilegios de usuario, haga algún trabajo no privilegiado, y luego recupere su ID de usuario efectivo original de una manera segura. .PP Si el usuario es root o si el programa es SUID a root, deben tomarse precauciones especiales. La función .B setuid comprueba el UID efectivo de quien la llama y si es el súper-usuario, todos los IDs relacionados con el proceso se ponen a .IR uid . Después de esto, es imposible para el programa recuperar sus privilegios de root. Así, un programa SUID a root que desea temporalmente renunciar a sus provilegios de root, asumir la identidad de un usuario no-root y luego recuperar sus privilegios de root no puede emplear .BR setuid . Esto se puede hacer con la llamada (no POSIX, BSD) .BR seteuid . .SH "VALOR DEVUELTO" En caso de éxito, se devuelve cero. En caso de error, se devuelve \-1, y se pone un valor apropiado en \fIerrno\fP. .SH ERRORES .TP 0.8i .B EPERM El usuario no es el súper-usuario, y .I uid no concuerda con el ID de usuario real ni guardado del proceso invocador. .SH "CONFORME A" SVr4, SVID, POSIX.1. No muy compatible con la llamada de 4.4BSD, que establece todos los IDs de usuario: real, salvado y efectivo. SVr4 documenta una condición de error adicional, EINVAL. .SH "OBSREVACIONES ESPECÍFICAS DE LINUX" Linux posee el concepto de UID de sistema de ficheros, normalmente igual al UID efectivo. La llamada a .B setuid también establece el UID de sistema de ficheros del proceso en curso. Vea .BR setfsuid (2). .PP Si .I uid es diferente del uid efectivo antiguo, al proceso se le prohibirá dejar volcados de memoria. .SH "VÉASE TAMBIÉN" .BR getuid (2), .BR setreuid (2), .BR seteuid (2), .BR setfsuid (2)