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.
If Distributed Services is installed on your system, this
path can cross into another node. 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.
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.
Diagnostics
The chroot system call fails and the effective root
directory remains unchanged if one or more of the fol-
lowing are true:
ENOTDIR Any component of the path name is not a direc-
tory.
ENOENT The named directory does not exist.
EPERM The effective user ID of the calling process
is not superuser.
EFAULT The path parameter &pointsout..
ESTALE The process's root or current directory is
located in a virtual file system that has been
unmounted.
If Distributed Services is installed on your system,
chroot can also fail if one or more of the following are
true:
EACCES Search permission was denied on a component
of the path.
The effective user ID of the calling
process must be the same as the superuser
ID to issue this call. Since with Distrib-
uted Services path can cross into another
node and a process that has superuser
authority in the local node probably does
not have superuser authority in the remote
node, search permission may be denied even
to the local superuser.
EDIST The server has blocked new inbound
requests.
EDIST Outbound requests are currently blocked.
EDIST The server has a release level of Distrib-
uted Services that cannot communicate with
this node.
EAGAIN The server is too busy to accept the
request.
ESTALE The file descriptor for a remote file has
become obsolete.
EPERM The translate tables of the server did not
contain any entry for either the effective
user ID or effective group ID of the
calling process.
ENODEV The named file is a remote file located on
a device that has been unmounted at the
server.
ENOMEM Either this node or the server does not
have enough memory available to service the
request.
ENOCONNECT An attempt to establish a new network con-
nection with a remote node failed.
EBADCONNECT An attempt to use an existing network con-
nection with a remote node failed.
Related Information
In this book: "chdir."
The chroot command in AIX Operating System Commands Ref-
erence.