Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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?

share|improve this question

migrated from 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.

share|improve this answer

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.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.