LinuxReviws.org --get your your Linux knowledge
> Linux Reviews > Manual Pages (man) >

chroot

run command or interactive shell with special root directory


  1. chroot.1.man
  2. chroot.2.man
  3. chroot.8.man


1. chroot.1.man

Manpage of CHROOT

CHROOT

Section: User Commands (1)
Updated: October 2011
Index Return to Main Contents
 

NAME

chroot - run command or interactive shell with special root directory  

SYNOPSIS

chroot [OPTION] NEWROOT [COMMAND [ARG]...]
chroot OPTION  

DESCRIPTION

Run COMMAND with root directory set to NEWROOT.

--userspec=USER:GROUP
specify user and group (ID or name) to use
--groups=G_LIST
specify supplementary groups as g1,g2,..,gN
--help
display this help and exit
--version
output version information and exit

If no command is given, run ``${SHELL} -i'' (default: /bin/sh).  

AUTHOR

Written by Roland McGrath.  

REPORTING BUGS

Report chroot bugs to bug-coreutils@gnu.org
GNU coreutils home page: <http://www.gnu.org/software/coreutils/>
General help using GNU software: <http://www.gnu.org/gethelp/>
Report chroot translation bugs to <http://translationproject.org/team/>  

COPYRIGHT

Copyright © 2011 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl>.
This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law.  

SEE ALSO

chroot(2)

The full documentation for chroot is maintained as a Texinfo manual. If the info and chroot programs are properly installed at your site, the command

info coreutils aqchroot invocationaq

should give you access to the complete manual.


 

Index

NAME
SYNOPSIS
DESCRIPTION
AUTHOR
REPORTING BUGS
COPYRIGHT
SEE ALSO

This document was created by man2html using the manual pages.
Time: 17:30:30 GMT, October 23, 2013

2. chroot.2.man

Manpage of CHROOT

CHROOT

Section: Linux Programmer's Manual (2)
Updated: 2010-09-20
Index Return to Main Contents
 

NAME

chroot - change root directory  

SYNOPSIS

#include <unistd.h>

int chroot(const char *path);

Feature Test Macro Requirements for glibc (see feature_test_macros(7)):

chroot():

Since glibc 2.2.2:
_BSD_SOURCE ||
    (_XOPEN_SOURCE >= 500 ||
        _XOPEN_SOURCE && _XOPEN_SOURCE_EXTENDED) &&
    !(_POSIX_C_SOURCE >= 200112L || _XOPEN_SOURCE >= 600)
Before glibc 2.2.2: none
 

DESCRIPTION

chroot() changes the root directory of the calling process to that specified in path. This directory will be used for pathnames beginning with /. The root directory is inherited by all children of the calling process.

Only a privileged process (Linux: one with the CAP_SYS_CHROOT capability) may call chroot().

This call changes an ingredient in the pathname resolution process and does nothing else.

This call does not change the current working directory, so that after the call aq.aq can be outside the tree rooted at aq/aq. In particular, the superuser can escape from a "chroot jail" by doing:


    mkdir foo; chroot foo; cd ..

This call does not close open file descriptors, and such file descriptors may allow access to files outside the chroot tree.  

RETURN VALUE

On success, zero is returned. On error, -1 is returned, and errno is set appropriately.  

ERRORS

Depending on the file system, other errors can be returned. The more general errors are listed below:
EACCES
Search permission is denied on a component of the path prefix. (See also path_resolution(7).)
EFAULT
path points outside your accessible address space.
EIO
An I/O error occurred.
ELOOP
Too many symbolic links were encountered in resolving path.
ENAMETOOLONG
path is too long.
ENOENT
The file does not exist.
ENOMEM
Insufficient kernel memory was available.
ENOTDIR
A component of path is not a directory.
EPERM
The caller has insufficient privilege.
 

CONFORMING TO

SVr4, 4.4BSD, SUSv2 (marked LEGACY). This function is not part of POSIX.1-2001.  

NOTES

A child process created via fork(2) inherits its parent's root directory. The root directory is left unchanged by execve(2).

FreeBSD has a stronger jail() system call.  

SEE ALSO

chdir(2), path_resolution(7)  

COLOPHON

This page is part of release 3.32 of the Linux man-pages project. A description of the project, and information about reporting bugs, can be found at http://www.kernel.org/doc/man-pages/.


 

Index

NAME
SYNOPSIS
DESCRIPTION
RETURN VALUE
ERRORS
CONFORMING TO
NOTES
SEE ALSO
COLOPHON

This document was created by man2html using the manual pages.
Time: 17:30:30 GMT, October 23, 2013

3. chroot.8.man

Manpage of CHROOT

CHROOT

Section: FSF (8)
Updated: July 2001
Index Return to Main Contents
 

NAME

chroot - run command or interactive shell with special root directory  

SYNOPSIS

chroot NEWROOT [COMMAND...]
chroot OPTION  

DESCRIPTION

Run COMMAND with root directory set to NEWROOT.

--help
display this help and exit
--version
output version information and exit

If no command is given, run ``${SHELL} -i'' (default: /bin/sh).  

AUTHOR

Written by Roland McGrath.  

REPORTING BUGS

Report bugs to <bug-sh-utils@gnu.org>.  

COPYRIGHT

Copyright © 2000 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  

SEE ALSO

The full documentation for chroot is maintained as a Texinfo manual. If the info and chroot programs are properly installed at your site, the command
info chroot

should give you access to the complete manual.


 

Index

NAME
SYNOPSIS
DESCRIPTION
AUTHOR
REPORTING BUGS
COPYRIGHT
SEE ALSO

This document was created by man2html using the manual pages.
Time: 17:30:30 GMT, October 23, 2013

cs - ENGLISH - ENGLISH - ENGLISH - ja - nl - pl - ENGLISH

Meet new people