start page | rating of books | rating of authors | reviews | copyrights

Programming Perl

Programming PerlSearch this book
Previous: 3.2.16 chr Chapter 3
Functions
Next: 3.2.18 close
 

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";


Previous: 3.2.16 chr Programming Perl Next: 3.2.18 close
3.2.16 chr Book Index 3.2.18 close