0

I was wondering if there's a way to run shell commands that affect only a certain directory and its subdirectories.

I'm using PHP and I want to make an app that allows the user to execute shell commands from a web page, but I want these commands to be restricted to a directory only

2

Avoid running any commands on your host machine originating from a web page. That's a recipe for disaster.

Have a look at operating system level virtualization. Depending on your OS you can use zones, jails or LXC.

Those OS level instances have a very low overhead and can be fired up pretty quickly. They do provide separation between the host OS and the user's environment. It's not as safe as a fully virtualized machine, but it might be sufficient for your use case.

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.