Your Browser is not longer supported
Please use Google Chrome, Mozilla Firefox or Microsoft Edge to view the page correctly
Loading...
{{viewport.spaceProperty.prod}}
chroot - change root directory
&pagelevel(4)&pagelevel
Description | path points to a pathname naming a directory. The chroot() function causes the nameddirectory to become the root directory, i.e. the starting point for path searches for pathnames beginning with /. The working directory of the user is not affected by chroot() . The process must have appropriate privileges to change the root directory. The .. (dot-dot) 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. chroot() is not reentrant.
|
Return val. | 0 -1 | if successful if an error occurs. errno is set to indicate the error. |
Errors | chroot() will fail if:
|
| EACCES
| Search permission is denied for a component of path. |
| Extension |
| EFAULT
EINTR
ELOOP
| An invalid address was passed as an argument. A signal was caught during the chroot() system call. Too many symbolic links were encountered in resolving path. (End) |
| ENAMETOOLONG
|
|
| The length of the path argument exceeds {PATH_MAX} or a pathname component is longer than {NAME_MAX} . |
| ENOENT
| path points to the name of a directory that does not exist or to an empty string. |
| ENOTDIR
| A component of the pathname path is not a directory . |
| EPERM
| The effective user ID is not that of a process with appropriate privileges. |
Notes | chroot() is executed only for POSIX directories.
chroot() works only in the currently active process and remains in effect only until the termination of that process.
|
See also | chdir() , unistd.h .
|