Search code examples
pythonunixsandbox

Run python script with reduced permissions


I have to run some student-made code that they made as homework, I'm running this on my own computer (Mac OS), and I'm not entirely certain they won't accidentally "rm -rf /" my machine. Is there an easy way to run their python scripts with reduced permissions, so that e.g. they can access only a certain directory? Is PyPy the way to go?


Solution

  • You could use a chroot environment. In this setup, the script can't access any files outside the chroot jail.