I'm running a web server, and I want to give some people FTP access to their own folders. I don't want these people to upload PHP scripts that are able to do anything they want with the server, but some are interested in running PHP scripts such as forums. Is there a way that I can restrict all PHP scripts in a certain folder to only have access to files and subdirectories in that folder?

migrated from stackoverflow.com Aug 25 '11 at 1:47

This question came from our site for professional and enthusiast programmers.


What you are asking for is known as a chroot jail, wherein from each user's perspective, his is the root directory of the server, and therefore cannot navigate upward to the the parent directory holding other users' directories. How you implement it depends on your FTP server, but most have a configuration option to enable it.


Michael's suggestion for using a chroot jail will do the job but is generally overkill for most web scenarios unless you are very paranoid.

Instead why not use something like suPHP where php runs as each different user/site. Then if file permissions are set correctly you will not be able to access areas which could cause damage to other server users. suphp is commonly used by some shared hosting providers.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy