DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 

chroot(S-osr5)


chroot -- change root directory

Syntax

cc . . . -lc

int chroot (path)
char *path;

Description

The path argument points to a pathname naming a directory. The chroot system call causes the named directory to become the root directory, the starting point for path searches for pathnames 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 fails and the root directory remains unchanged if one or more of the following is true:


[EFAULT]
The path argument points outside the allocated address space of the process.

[EINTR]
A signal was caught during the chroot system call.

[EMULTIHOP]
Components of path require hopping to multiple remote machines.

[ENOENT]
The named directory does not exist.

[ENOLINK]
The path argument points to a remote machine and the link to that machine is no longer active.

[ENOTDIR]
Any component of the pathname is not a directory.

[EPERM]
The effective user ID is not super user.

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.

See also

chdir(S-osr5)

Standards conformance

chroot is conformant with:

X/Open Portability Guide, Issue 3, 1989 .


© 2005 The SCO Group, Inc. All rights reserved.
SCO OpenServer Release 6.0.0 -- 02 June 2005