I run this command at the command line:
$ sudo chroot . node test/simple.js
And I get this error:
chroot: failed to run command ‘node’: No such file or directory
makes sense, since the node executable is located in a file below the PWD. So what is a good way to get the node executable within the PWD, should I symlink it?
Ultimately however, I am most interested in allowing all executables to run in the chroot jail, but only allow reading and writing to files within the chroot jail, AKA:
randos/
node
a.js
jail/
foo/foo.js
so say I do:
cd jail/foo
sudo chroot . ../randos/node ../randos/a.js
that should fail because I shouldn't be able to read randos/a.js. But if I do this:
cd jail/foo
sudo chroot . ../randos/node foo.js
then it should work, even if the node executable file is not a file within the jail.
Also, as an aside, if anyone knows how to get chroot to run without sudo for a certain directory, that'd be good.