Just wondering is there any way to create a temporary sandbox environment for running commands?
My requirement is that i am hosting a webservice in unix and i need to execute a commanline tool to return output to the webservice client. since i am passing the values received from the client to the commanline tool, i would like to execute the commands in sandboxed environment.
I’m not sure but, you can try to use the “chroot” command to create new “root” enviroment, for example,
If you have the directory structure and you want to “protect” the “license” file,
You can create a chroot enviroment as
Now populate the “shared lib” required by the ls command (using the ldd we know which are the required shared libs
Now we need to copy to our new “lib” and usr/lib directory
So, the final structure is
Also you need the group, passwd and other files
Now you can run the chroot command, but if you try to run as non root you will get the error
So, you need to run as root
I hope it’s what you are looking for …
Urko,