CHROOT(S) UNIX System V CHROOT(S)
Name
chroot - change root directory
Syntax
int chroot (path)
char *path;
Description
The path argument points to a path name naming a directory.
The chroot system call causes the named directory to become
the root directory, the starting point for path searches for
path names beginning with /. The user's working directory
is unaffected by the chroot system call.
The effective user ID of the process must be super-user to
change the root directory.
The .. entry in the root directory is interpreted to mean
the root directory itself. Thus, .. cannot be used to
access files outside the subtree rooted at the root
directory.
The chroot system call will fail and the root directory will
remain unchanged if one or more of the following is true:
[ENOTDIR] Any component of the path name is not a
directory.
[ENOENT] The named directory does not exist.
[EPERM] The effective user ID is not super-user.
[EFAULT] The path argument points outside the
allocated address space of the process.
[EINTR] A signal was caught during the chroot system
call.
[ENOLINK] The path argument points to a remote machine
and the link to that machine is no longer
active.
[EMULTIHOP] Components of path require hopping to
multiple remote machines.
See Also
chdir(S).
Diagnostics
Upon successful completion, a value of 0 is returned.
Otherwise, a value of -1 is returned, and errno is set to
indicate the error.
Standards Conformance
chroot is conformant with:
AT&T SVID Issue 2, Select Code 307-127;
and The X/Open Portability Guide II of January 1987.
(printed 6/20/89)