When you run chroot on a directory, it sets the root directory to that directory, creating a sandbox. All programs should work from inside the sandbox, and nothing inside the sandbox should be able to touch files outside of it.
To use this program, you create a chroot environment by typing in "mkroot [directory]", then enter it by typing in "chroot [directory]"
(Due to the nature of this program, it will most likely not work on future versions of ComputerCraft, and will need updating for them. The download is attached to this post. Versions before v1.0.5 can be found here.)
==Changelog==
Version v1.0:
- Initial Release
Version v1.0.1:
- Added check in bios.lua to prevent it from being run with a BIOS already running (why didn't I think of doing this last version?)
Version v1.0.2:
- Fixed mkroot for recursive chroots
- Added code in bios.lua so that rednet (hopefully) will work if started in an external system without rednet.
Version v1.0.3:
- chroot now adds http to the chroot environment if it exists. Don't ask me to do the same for luajava. That will never happen.
Version v1.0.4:
- Fixed .. in the root directory
- Fixed access to external environment by calling getfenv on external functions
- Added disk access to the chroot environment (possibly dangerous if the chroot is on a disk itself.)
Version v1.0.5:
- Dealt with the remaining known sandbox leaks.