Question

I have a need to only run a certain portion of code from a node.js script under a chroot. I've setup the the chroot and am using the daemon.chroot. The chrooting works great, but I need to be able to unchroot the process and re-chroot it elsewhere. I understand now (in previous languages I would fork the process, and have the the child run in the chroot) that Node.js chroots the entire running process, so subsequent attempts to chroot different environments leaves Node complaining that the chroot doesn't exist, and it doesn't exist inside of the previous chroot.

What's the best way to accomplish this ability to chroot then "unchroot" a portion of code or a process in with Node?

Était-ce utile?

La solution

It doesn't really make sense to un-chroot a process. This is like putting someone in jail and handing them the keys to the cell. Node should be able to support your previous approach just fine though:

http://nodejs.org/api/child_process.html#child_process_child_process_fork_modulepath_args_options

It works a little bit differently from the classic unix fork, but it should support your case just fine.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top