.\" -*- coding: UTF-8 -*- .\" Copyright (c) 1992 Drew Eckhardt (drew@cs.colorado.edu), March 28, 1992 .\" .\" SPDX-License-Identifier: Linux-man-pages-copyleft .\" .\" Modified by Michael Haardt .\" Modified 1993-07-21 by Rik Faith .\" Modified 1994-08-21 by Michael Chastain .\" Modified 1996-06-13 by aeb .\" Modified 1996-11-06 by Eric S. Raymond .\" Modified 1997-08-21 by Joseph S. Myers .\" Modified 2004-06-23 by Michael Kerrisk .\" .\"******************************************************************* .\" .\" This file was generated with po4a. Translate the source file. .\" .\"******************************************************************* .TH chroot 2 "5 Febrero 2023" "Páginas de manual de Linux 6.03" .SH NOMBRE chroot \- cambia el directorio raíz .SH BIBLIOTECA Biblioteca Estándar C (\fIlibc\fP, \fI\-lc\fP) .SH SINOPSIS .nf \fB#include \fP .PP \fBint chroot(const char *\fP\fIruta\fP\fB);\fP .fi .PP .RS -4 Requisitos de Macros de Prueba de Características para glibc (véase \fBfeature_test_macros\fP(7)): .RE .PP \fBchroot\fP(): .nf Since glibc 2.2.2: _XOPEN_SOURCE && ! (_POSIX_C_SOURCE >= 200112L) || /* Since glibc 2.20: */ _DEFAULT_SOURCE || /* glibc <= 2.19: */ _BSD_SOURCE Before glibc 2.2.2: none .fi .SH DESCRIPCIÓN \fBchroot\fP() cambia el directorio raíz al definido en \fIruta\fP. Este directorio será usado como raíz para aquellos nombres de ruta que comiencen por /. El directorio raíz es heredado por todos los descendientes del proceso actual. .PP Sólo los procesos privilegiados (en Linux serán aquello con la capacidad \fBCAP_SYS_CHROOT\fP en su espacio de nombre de usuario) puede invocar \fBchroot\fP(). .PP This call changes an ingredient in the pathname resolution process and does nothing else. In particular, it is not intended to be used for any kind of security purpose, neither to fully sandbox a process nor to restrict filesystem system calls. In the past, \fBchroot\fP() has been used by daemons to restrict themselves prior to passing paths supplied by untrusted users to system calls such as \fBopen\fP(2). However, if a folder is moved out of the chroot directory, an attacker can exploit that to get out of the chroot directory as well. The easiest way to do that is to \fBchdir\fP(2) to the to\-be\-moved directory, wait for it to be moved out, then open a path like \&../../../etc/passwd. .PP .\" This is how the "slightly trickier variation" works: .\" https://github.com/QubesOS/qubes-secpack/blob/master/QSBs/qsb-014-2015.txt#L142 A slightly trickier variation also works under some circumstances if \fBchdir\fP(2) is not permitted. If a daemon allows a "chroot directory" to be specified, that usually means that if you want to prevent remote users from accessing files outside the chroot directory, you must ensure that folders are never moved out of it. .PP Esta llamada no cambia el directorio de trabajo actual, por lo que el directorio \[aq]\fI.\fP\[aq] puede estar fuera del árbol enraizado en \[aq]\fI/\fP\[aq]. En particular, el administrador puede escapar de una "prisión chroot" ejecutando: .PP .in +4n .EX mkdir foo; chroot foo; cd .. .EE .in .PP This call does not close open file descriptors, and such file descriptors may allow access to files outside the chroot tree. .SH "VALOR DEVUELTO" En caso de éxito se devuelve cero. En caso de error se devuelve \-1, y \fIerrno\fP se configura para indicar el error. .SH ERRORES Según el sistema de ficheros, se pueden obtener otros errores. Los errores más comunes se listan a continuación: .TP \fBEACCES\fP .\" Also search permission is required on the final component, .\" maybe just to guarantee that it is a directory? Search permission is denied on a component of the path prefix. (See also \fBpath_resolution\fP(7).) .TP \fBEFAULT\fP \fIpath\fP apunta fuera de su espacio de direcciones accesibles. .TP \fBEIO\fP Ocurrió un error de E/S. .TP \fBELOOP\fP Se encontraron demasiados enlaces simbólicos al resolver \fIpath\fP. .TP \fBENAMETOOLONG\fP \fIpath\fP es demasiado largo. .TP \fBENOENT\fP El fichero no existe. .TP \fBENOMEM\fP No hay disponible suficiente memoria del núcleo. .TP \fBENOTDIR\fP Un componente del camino \fIpath\fP no es un directorio. .TP \fBEPERM\fP The caller has insufficient privilege. .SH ESTÁNDARES .\" SVr4 documents additional EINTR, ENOLINK and EMULTIHOP error conditions. .\" X/OPEN does not document EIO, ENOMEM or EFAULT error conditions. SVr4, 4.4BSD, SUSv2 (marked LEGACY). This function is not part of POSIX.1\-2001. .SH NOTAS A child process created via \fBfork\fP(2) inherits its parent's root directory. The root directory is left unchanged by \fBexecve\fP(2). .PP The magic symbolic link, \fI/proc/[pid]/root\fP, can be used to discover a process's root directory; see \fBproc\fP(5) for details. .PP FreeBSD has a stronger \fBjail\fP() system call. .SH "VÉASE TAMBIÉN" \fBchroot\fP(1), \fBchdir\fP(2), \fBpivot_root\fP(2), \fBpath_resolution\fP(7), \fBswitch_root\fP(8) .PP .SH TRADUCCIÓN La traducción al español de esta página del manual fue creada por Miguel Angel Sepulveda , Juan Piernas , Miguel Pérez Ibars y Marcos Fouces . .PP Esta traducción es documentación libre; lea la .UR https://www.gnu.org/licenses/gpl-3.0.html GNU General Public License Version 3 .UE o posterior con respecto a las condiciones de copyright. No existe NINGUNA RESPONSABILIDAD. .PP Si encuentra algún error en la traducción de esta página del manual, envíe un correo electrónico a .MT debian-l10n-spanish@lists.debian.org .ME .