[Chapter 3] 3.2.17 chroot
Author: Larry Wall, Tom Christiansen & Randal L. Schwartz
Date: 1999-07-02T01:48:03Z

#

| Chapter 3 Functions |

### 3.2.17 chroot

    chroot FILENAME

This function does the same operation as the chroot system call - see chroot(2). If successful, `FILENAME` becomes the new root directory for the current process - the starting point for pathnames beginning with "`/`". This directory is inherited across exec calls and by all subprocesses. There is no way to undo a chroot. Only the superuser can use this function. Here's some code that approximates what many FTP servers do:

    chroot +(getpwnam('ftp'))[7]
        or die "Can't do anonymous ftp: $!\n";

3.2.16 chr |  | 3.2.18 close