chroot command: failed to run command ‘node’: No such file or directory [closed]

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
0
down vote

favorite












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.










share|improve this question















closed as unclear what you're asking by Ipor Sircer, Isaac, Filipe Brandenburger, G-Man, Thomas Nov 25 at 11:34


Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.










  • 1




    Unfortunately none of that is how it works. What is your actual goal?
    – Michael Homer
    Nov 24 at 20:22










  • @MichaelHomer yeah you might be right, here is the actual goal: github.com/nodejs/node/issues/24633
    – Alexander Mills
    Nov 24 at 20:24














up vote
0
down vote

favorite












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.










share|improve this question















closed as unclear what you're asking by Ipor Sircer, Isaac, Filipe Brandenburger, G-Man, Thomas Nov 25 at 11:34


Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.










  • 1




    Unfortunately none of that is how it works. What is your actual goal?
    – Michael Homer
    Nov 24 at 20:22










  • @MichaelHomer yeah you might be right, here is the actual goal: github.com/nodejs/node/issues/24633
    – Alexander Mills
    Nov 24 at 20:24












up vote
0
down vote

favorite









up vote
0
down vote

favorite











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.










share|improve this question















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.







chroot






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 24 at 20:48









Rui F Ribeiro

38.3k1476127




38.3k1476127










asked Nov 24 at 19:30









Alexander Mills

2,10211238




2,10211238




closed as unclear what you're asking by Ipor Sircer, Isaac, Filipe Brandenburger, G-Man, Thomas Nov 25 at 11:34


Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.






closed as unclear what you're asking by Ipor Sircer, Isaac, Filipe Brandenburger, G-Man, Thomas Nov 25 at 11:34


Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.









  • 1




    Unfortunately none of that is how it works. What is your actual goal?
    – Michael Homer
    Nov 24 at 20:22










  • @MichaelHomer yeah you might be right, here is the actual goal: github.com/nodejs/node/issues/24633
    – Alexander Mills
    Nov 24 at 20:24












  • 1




    Unfortunately none of that is how it works. What is your actual goal?
    – Michael Homer
    Nov 24 at 20:22










  • @MichaelHomer yeah you might be right, here is the actual goal: github.com/nodejs/node/issues/24633
    – Alexander Mills
    Nov 24 at 20:24







1




1




Unfortunately none of that is how it works. What is your actual goal?
– Michael Homer
Nov 24 at 20:22




Unfortunately none of that is how it works. What is your actual goal?
– Michael Homer
Nov 24 at 20:22












@MichaelHomer yeah you might be right, here is the actual goal: github.com/nodejs/node/issues/24633
– Alexander Mills
Nov 24 at 20:24




@MichaelHomer yeah you might be right, here is the actual goal: github.com/nodejs/node/issues/24633
– Alexander Mills
Nov 24 at 20:24










1 Answer
1






active

oldest

votes

















up vote
1
down vote













I would use the symlink option.



Also to answer your aside, I would edit your sudoers file.



Add a line that looks like:



SOMEUSER ALL=/usr/sbin/chroot /DIR/TO/JAIL





share|improve this answer




















  • thanks for the info, upvoted. yeah but in this for a library, I need all executables outside the jail to be available, and I'd rather not permanently change the sudoers file.
    – Alexander Mills
    Nov 24 at 20:09










  • Yea, that makes things more interesting... @AlexanderMills
    – Michael Prokopec
    Nov 24 at 20:14











  • yeah I don't think chroot works the way I want, might have to find a different solution, perhaps a Docker container is the only way idk
    – Alexander Mills
    Nov 24 at 20:24










  • Here is the ultimate goal, btw: github.com/nodejs/node/issues/24633
    – Alexander Mills
    Nov 24 at 20:25

















1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes








up vote
1
down vote













I would use the symlink option.



Also to answer your aside, I would edit your sudoers file.



Add a line that looks like:



SOMEUSER ALL=/usr/sbin/chroot /DIR/TO/JAIL





share|improve this answer




















  • thanks for the info, upvoted. yeah but in this for a library, I need all executables outside the jail to be available, and I'd rather not permanently change the sudoers file.
    – Alexander Mills
    Nov 24 at 20:09










  • Yea, that makes things more interesting... @AlexanderMills
    – Michael Prokopec
    Nov 24 at 20:14











  • yeah I don't think chroot works the way I want, might have to find a different solution, perhaps a Docker container is the only way idk
    – Alexander Mills
    Nov 24 at 20:24










  • Here is the ultimate goal, btw: github.com/nodejs/node/issues/24633
    – Alexander Mills
    Nov 24 at 20:25














up vote
1
down vote













I would use the symlink option.



Also to answer your aside, I would edit your sudoers file.



Add a line that looks like:



SOMEUSER ALL=/usr/sbin/chroot /DIR/TO/JAIL





share|improve this answer




















  • thanks for the info, upvoted. yeah but in this for a library, I need all executables outside the jail to be available, and I'd rather not permanently change the sudoers file.
    – Alexander Mills
    Nov 24 at 20:09










  • Yea, that makes things more interesting... @AlexanderMills
    – Michael Prokopec
    Nov 24 at 20:14











  • yeah I don't think chroot works the way I want, might have to find a different solution, perhaps a Docker container is the only way idk
    – Alexander Mills
    Nov 24 at 20:24










  • Here is the ultimate goal, btw: github.com/nodejs/node/issues/24633
    – Alexander Mills
    Nov 24 at 20:25












up vote
1
down vote










up vote
1
down vote









I would use the symlink option.



Also to answer your aside, I would edit your sudoers file.



Add a line that looks like:



SOMEUSER ALL=/usr/sbin/chroot /DIR/TO/JAIL





share|improve this answer












I would use the symlink option.



Also to answer your aside, I would edit your sudoers file.



Add a line that looks like:



SOMEUSER ALL=/usr/sbin/chroot /DIR/TO/JAIL






share|improve this answer












share|improve this answer



share|improve this answer










answered Nov 24 at 20:02









Michael Prokopec

68916




68916











  • thanks for the info, upvoted. yeah but in this for a library, I need all executables outside the jail to be available, and I'd rather not permanently change the sudoers file.
    – Alexander Mills
    Nov 24 at 20:09










  • Yea, that makes things more interesting... @AlexanderMills
    – Michael Prokopec
    Nov 24 at 20:14











  • yeah I don't think chroot works the way I want, might have to find a different solution, perhaps a Docker container is the only way idk
    – Alexander Mills
    Nov 24 at 20:24










  • Here is the ultimate goal, btw: github.com/nodejs/node/issues/24633
    – Alexander Mills
    Nov 24 at 20:25
















  • thanks for the info, upvoted. yeah but in this for a library, I need all executables outside the jail to be available, and I'd rather not permanently change the sudoers file.
    – Alexander Mills
    Nov 24 at 20:09










  • Yea, that makes things more interesting... @AlexanderMills
    – Michael Prokopec
    Nov 24 at 20:14











  • yeah I don't think chroot works the way I want, might have to find a different solution, perhaps a Docker container is the only way idk
    – Alexander Mills
    Nov 24 at 20:24










  • Here is the ultimate goal, btw: github.com/nodejs/node/issues/24633
    – Alexander Mills
    Nov 24 at 20:25















thanks for the info, upvoted. yeah but in this for a library, I need all executables outside the jail to be available, and I'd rather not permanently change the sudoers file.
– Alexander Mills
Nov 24 at 20:09




thanks for the info, upvoted. yeah but in this for a library, I need all executables outside the jail to be available, and I'd rather not permanently change the sudoers file.
– Alexander Mills
Nov 24 at 20:09












Yea, that makes things more interesting... @AlexanderMills
– Michael Prokopec
Nov 24 at 20:14





Yea, that makes things more interesting... @AlexanderMills
– Michael Prokopec
Nov 24 at 20:14













yeah I don't think chroot works the way I want, might have to find a different solution, perhaps a Docker container is the only way idk
– Alexander Mills
Nov 24 at 20:24




yeah I don't think chroot works the way I want, might have to find a different solution, perhaps a Docker container is the only way idk
– Alexander Mills
Nov 24 at 20:24












Here is the ultimate goal, btw: github.com/nodejs/node/issues/24633
– Alexander Mills
Nov 24 at 20:25




Here is the ultimate goal, btw: github.com/nodejs/node/issues/24633
– Alexander Mills
Nov 24 at 20:25


Popular posts from this blog

How to check contact read email or not when send email to Individual?

Bahrain

Postfix configuration issue with fips on centos 7; mailgun relay