CHROOT(2,L) AIX Technical Reference CHROOT(2,L)
-------------------------------------------------------------------------------
chroot
PURPOSE
Changes the effective root directory.
SYNTAX
int chroot (path)
char *path;
DESCRIPTION
The chroot system call causes the directory named by the path parameter to
become the effective root directory. The effective root directory is the
starting point when searching for a file whose path name begins with / (slash).
The current directory is not affected by the chroot system call.
The effective user ID of the calling process must be superuser to change the
effective root directory.
The ".." (dot-dot) entry in the effective root directory is interpreted to mean
the effective root directory itself. Thus, ".." (dot-dot) cannot be used to
access files outside the subtree rooted at the effective root directory.
The chroot system call simulates a call to setlocal with the process's current
<LOCAL> alias, and as a result, the alias is re-evaluated within the new root
directory. If the new root directory does not contain a directory named by the
process's current <LOCAL> alias, subsequent references to symbolic links which
begin with "<LOCAL>" return an ENOENT error.
RETURN VALUE
Upon successful completion, a value of 0 is returned. If the chroot system
call fails, a value of -1 is returned, and errno is set to indicate the error.
ERROR CONDITIONS
The chroot system call fails and the effective root directory remains unchanged
if one or more of the following are true:
ENOTDIR Any component of the path name is not a directory.
ENOENT The named directory does not exist.
EPERM The effective user ID of the calling process is not superuser.
Processed November 7, 1990 CHROOT(2,L) 1
CHROOT(2,L) AIX Technical Reference CHROOT(2,L)
EFAULT The path parameter points to a location outside of the process's
allocated address space.
ESTALE The process's root or current directory is located in an NFS virtual
file system that has been unmounted.
ENAMETOOLONG
A component of the path parameter exceeded NAME_MAX characters, or
the entire path parameter exceeded PATH_MAX characters.
ENOENT A hidden directory was named, but no component inside it matched the
process's current site path list.
ENOENT A symbolic link was named, but the file to which it refers does not
exist.
ENOENT A NULL path name was provided.
ELOOP A loop of symbolic links was detected.
If the Transparent Computing Facility is installed on your system, chroot can
also fail if one or more of the following are true:
ESITEDN1 The path cannot be accessed because a site went down.
ESITEDN2 The operation was terminated because a site failed.
ENOSTORE The path is a name relative to the working directory, but no site
which stores this directory is currently up.
ENOSTORE A component of path is replicated but not stored on any site which is
currently up.
EINTR A signal was caught during the chroot system call.
RELATED INFORMATION
In this book: "chdir," "getlocal, setlocal."
The chroot command in AIX Operating System Commands Reference.
Processed November 7, 1990 CHROOT(2,L) 2