Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

chroot(2) [redhat man page]

CHROOT(2)						     Linux Programmer's Manual							 CHROOT(2)

NAME
chroot - change root directory SYNOPSIS
#include <unistd.h> int chroot(const char *path); DESCRIPTION
chroot changes the root directory to that specified in path. This directory will be used for path names beginning with /. The root direc- tory is inherited by all children of the current process. Only the super-user may change the root directory. Note that this call does not change the current working directory, so that `.' can be outside the tree rooted at `/'. In particular, the super-user can escape from a `chroot jail' by doing `mkdir foo; chroot foo; cd ..'. RETURN VALUE
On success, zero is returned. On error, -1 is returned, and errno is set appropriately. ERRORS
Depending on the file system, other errors can be returned. The more general errors are listed below: EPERM The effective UID is not zero. EFAULT path points outside your accessible address space. ENAMETOOLONG path is too long. ENOENT The file does not exist. ENOMEM Insufficient kernel memory was available. ENOTDIR A component of path is not a directory. EACCES Search permission is denied on a component of the path prefix. ELOOP Too many symbolic links were encountered in resolving path. EIO An I/O error occurred. CONFORMING TO
SVr4, SVID, 4.4BSD, X/OPEN. This function is not part of POSIX.1. SVr4 documents additional EINTR, ENOLINK and EMULTIHOP error condi- tions. X/OPEN does not document EIO, ENOMEM or EFAULT error conditions. This interface is marked as legacy by X/OPEN. SEE ALSO
chdir(2) Linux 2.0.30 1997-08-21 CHROOT(2)

Check Out this Related Man Page

CHDIR(2)						     Linux Programmer's Manual							  CHDIR(2)

NAME
chdir, fchdir - change working directory SYNOPSIS
#include <unistd.h> int chdir(const char *path); int fchdir(int fd); DESCRIPTION
chdir changes the current directory to that specified in path. fchdir is identical to chdir, only that the directory is given as an open file descriptor. RETURN VALUE
On success, zero is returned. On error, -1 is returned, and errno is set appropriately. ERRORS
Depending on the file system, other errors can be returned. The more general errors for chdir are listed below: EFAULT path points outside your accessible address space. ENAMETOOLONG path is too long. ENOENT The file does not exist. ENOMEM Insufficient kernel memory was available. ENOTDIR A component of path is not a directory. EACCES Search permission is denied on a component of path. ELOOP Too many symbolic links were encountered in resolving path. EIO An I/O error occurred. The general errors for fchdir are listed below: EBADF fd is not a valid file descriptor. EACCES Search permission was denied on the directory open on fd. NOTES
The prototype for fchdir is only available if _BSD_SOURCE is defined (either explicitly, or implicitly, by not defining _POSIX_SOURCE or compiling with the -ansi flag). CONFORMING TO
The chdir call is compatible with SVr4, SVID, POSIX, X/OPEN, 4.4BSD. SVr4 documents additional EINTR, ENOLINK, and EMULTIHOP error condi- tions but has no ENOMEM. POSIX.1 does not have ENOMEM or ELOOP error conditions. X/OPEN does not have EFAULT, ENOMEM or EIO error condi- tions. The fchdir call is compatible with SVr4, 4.4BSD and X/OPEN. SVr4 documents additional EIO, EINTR, and ENOLINK error conditions. X/OPEN documents additional EINTR and EIO error conditions. SEE ALSO
getcwd(3), chroot(2) Linux 2.0.30 1997-08-21 CHDIR(2)
Man Page

5 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How to change prompt color when changing path

Hi all, Can you tell me how to change the prompt color (only the path part) when I chnange directory with "cd"? I use the sequence below in ".bashrc" (Solaris 8) to change my prompt colors and I'd like to modify it to change the path color when I cange directory. PSC() { echo -ne "\"; }... (0 Replies)
Discussion started by: majormark
0 Replies

2. UNIX for Dummies Questions & Answers

change and replacing headerfile path

Hello, I just need to repalce my include path of an cd.h file in a dir which is having more tha 100 files. I used some sed and grep but unsuccessful. I am using HP_UX and i need to change #include "cd.h" to #include <cd.h> Please advise me. (1 Reply)
Discussion started by: jagan_kalluri
1 Replies

3. Shell Programming and Scripting

Need comma separated processing

I have a file like this OUTLN OPEN Y SCOTT OPEN N USER4 OPEN Y DBSNMP EXPIRED & LOCKED N ... (4 Replies)
Discussion started by: ilugopal
4 Replies

4. Shell Programming and Scripting

Need to append at end

I have the following input axrsgpar0335 METTEST DPC OUTLN OPEN Y axrsgpar0335 METTEST DPC SYS ... (4 Replies)
Discussion started by: ilugopal
4 Replies

5. Linux

mkdir command

Hi all, i am new to Linux and need some help. I used the command: mkdir super Directory super is created When i try to change to this directory using: cd /super I get: bash: cd: /super: No such file or directory when i use: rm super I get: rm: cannot remove 'super': Is a directory What... (5 Replies)
Discussion started by: Deside
5 Replies