Museum

Home

Lab Overview

Retrotechnology Articles

⇒ Online Manual

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

chdir(2)

chdir(1)

CHROOT(2)                            SysV                            CHROOT(2)



NAME
     chroot - Change the effective root directory

SYNOPSIS
     int chroot (path)
     const char *path;

DESCRIPTION
     The chroot function causes the directory named by the path argument to
     become the effective root directory. path points to the new effective
     root directory. If the path argument refers to a symbolic link, the
     chroot function sets the effective root directory to the directory
     pointed to by the symbolic link.

     The effective root directory is the starting point when searching for a
     file's pathname that begins with a / (slash). The current working
     directory is not affected by the chroot function.

     The calling process must have superuser privilege in order to change the
     effective root directory.  The calling process must also have search
     access to the new 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.

DIAGNOSTICS
     Upon successful completion, a value of 0 (zero) is returned.  If the
     chroot function fails, a value of -1 is returned and errno is set to
     indicate the error.

ERRORS
     If the chroot function fails, the effective root directory remains
     unchanged and errno may be set to one of the following values:

     [EACCES]  Search permission is denied for any component of the pathname.

     [EPERM]   The process does not have appropriate privilege.

     [ENOENT]  The path argument does not exist or points to an empty string.

     [ENAMETOOLONG]
               The length of the path argument exceeds PATH_MAX or a pathname
               component is longer than NAME_MAX.

     [ENOTDIR] A component of path is not a directory.

SEE ALSO
     chdir(2) chdir(1)

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026