chroot(2) chroot(2)NAME chroot - change root directory SYNOPSIS int chroot(path) char *path; DESCRIPTION chroot causes the named directory to become the root direc- tory, the starting point for path searches for path names beginning with /. The user's working directory is unaffect- ed by the chroot system call. path points to a path name naming a directory. The effective user ID of the process must be the superuser to change the root directory. The .. entry in the root directory is interpreted to mean the root directory itself. Thus, .. cannot be used to ac- cess files outside the subtree rooted at the root directory. RETURN VALUE Upon successful completion, a value of 0 is returned. Oth- erwise, a value of -1 is returned and errno is set to indi- cate the error. ERRORS chroot will fail and the root directory will remain un- changed if one or more of the following are true: [ENOTDIR] Any component of the path name is not a direc- tory. [ENAMETOOLONG] A component of a pathname exceeded NAME_MAX characters, or an entire pathname exceeded PATH_MAX. [ELOOP] Too many symbolic links were encountered in translating a pathname. [ENOENT] The named directory does not exist. [EPERM] A pathname contains a character with the high- order bit set. [EPERM] The effective user ID is not the superuser. [EFAULT] path points outside the allocated address space of the process. April, 1990 1
chroot(2) chroot(2)SEE ALSO chroot(1M), chdir(2). 2 April, 1990