chroot(2)chroot(2)Namechroot - change root directory
The dirname is the address of the pathname of a directory, terminated
by a null byte. The system call causes this directory to become the
root directory (/).
For a directory to become the root directory, a process must have exe‐
cute (search) access to the directory.
This call is restricted to the superuser.
Upon successful completion, a value of 0 is returned. Otherwise, a
value of -1 is returned and errno is set to indicate an error.
The system call fails and the root directory is unchanged under the
[ENOTDIR] A component of the dirname is not a directory.
[ENAMETOOLONG] A component of a dirname exceeded 255 characters, or an
entire dirname exceeded 1023 characters.
[ENOENT] The dirname argument points to the name of a directory
which does not exist, or to an empty string and the
environment defined is POSIX or SYSTEM_FIVE.
[EFAULT] The dirname points outside the process's allocated
[ELOOP] Too many symbolic links were encountered in translating
[EIO] An I/O error occurred while reading from or writing to
the file system.
[ESTALE] The file handle given in the argument is invalid. The
file referred to by that file handle no longer exists or
has been revoked.
[ETIMEDOUT] A connect request or remote file operation failed
because the connected party did not properly respond
after a period of time that is dependent on the communi‐
[EPERM] The effective user ID is not that of superuser.