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')) or die "Can't do anonymous ftp: $!\n";