Linux - SoftwareThis forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I'm trying to jail my Apache server but chroot always gives me an error message when I execute the following command as root.
># chroot /jail /export/srv/www/apache2/bin/httpd
chroot: cannot run command `/export/srv/www/apache2/bin/httpd': No such file or directory
/export/srv/www/apache2/bin/httpd does exist under /jail which is off the filesystem root. Running an strace on the command shows that chroot does successfully change /jail to "/" but the it says that the command path cannot be found.
I don't understand what is wrong. I am running Suse 9.1 Professional.
Distribution: Slackware64 14.2 and current, SlackwareARM current
Posts: 1,646
Rep:
Just a couple of thoughts:
In your problem description is a typo: after the /jail there is an extra space -- did you intend this or should it be deleted?
Did you ensure, that under /jail (or /export, depends on your first answer ) there are the same directories you need, e. g. /jail/bin etc.? If you intend to handle this another way you could of course change the path after doing chroot?
From what I understand the chroot command take the first argument (/jail) and sets that as the new root (/). The command (/export/srv/www/apache2/bin/httpd) is now executed starting at root which in this case is really /jail.
Please ignore this post. The problem has been resolved. The command is correct but my symlinks were pointing to a path that doesn't exist once the directory gets chroot'd. Here's a tip, always use relative path links within a chroot jail.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.