1 | .\" Copyright (c) 1983 Regents of the University of California.
|
---|
2 | .\" All rights reserved. The Berkeley software License Agreement
|
---|
3 | .\" specifies the terms and conditions for redistribution.
|
---|
4 | .\"
|
---|
5 | .\" @(#)chroot.2 6.3 (Berkeley) 8/26/85
|
---|
6 | .\"
|
---|
7 | .TH CHROOT 2 "August 26, 1985"
|
---|
8 | .UC 5
|
---|
9 | .SH NAME
|
---|
10 | chroot \- change root directory
|
---|
11 | .SH SYNOPSIS
|
---|
12 | .nf
|
---|
13 | .ft B
|
---|
14 | #include <unistd.h>
|
---|
15 |
|
---|
16 | int chroot(const char *\fIdirname\fP)
|
---|
17 | .ft R
|
---|
18 | .fi
|
---|
19 | .SH DESCRIPTION
|
---|
20 | .I Dirname
|
---|
21 | is the address of the pathname of a directory, terminated by a null byte.
|
---|
22 | .B Chroot
|
---|
23 | causes this directory
|
---|
24 | to become the root directory,
|
---|
25 | the starting point for path names beginning with ``/''.
|
---|
26 | .PP
|
---|
27 | In order for a directory to become the root directory
|
---|
28 | a process must have execute (search) access to the directory.
|
---|
29 | .PP
|
---|
30 | This call is restricted to the super-user.
|
---|
31 | .SH "RETURN VALUE
|
---|
32 | Upon successful completion, a value of 0 is returned. Otherwise,
|
---|
33 | a value of \-1 is returned and \fBerrno\fP is set to indicate an error.
|
---|
34 | .SH ERRORS
|
---|
35 | .B Chroot
|
---|
36 | will fail and the root directory will be unchanged if
|
---|
37 | one or more of the following are true:
|
---|
38 | .TP 15
|
---|
39 | [ENOTDIR]
|
---|
40 | A component of the path name is not a directory.
|
---|
41 | .TP 15
|
---|
42 | [ENAMETOOLONG]
|
---|
43 | The path name exceeds PATH_MAX characters.
|
---|
44 | .TP 15
|
---|
45 | [ENOENT]
|
---|
46 | The named directory does not exist.
|
---|
47 | .TP 15
|
---|
48 | [EACCES]
|
---|
49 | Search permission is denied for any component of the path name.
|
---|
50 | .TP 15
|
---|
51 | [ELOOP]
|
---|
52 | Too many symbolic links were encountered in translating the pathname.
|
---|
53 | (Minix-vmd)
|
---|
54 | .TP 15
|
---|
55 | [EFAULT]
|
---|
56 | .I Path
|
---|
57 | points outside the process's allocated address space.
|
---|
58 | .TP 15
|
---|
59 | [EIO]
|
---|
60 | An I/O error occurred while reading from or writing to the file system.
|
---|
61 | .SH "SEE ALSO"
|
---|
62 | .BR chdir (2).
|
---|