LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This 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


Reply
  Search this Thread
Old 04-05-2005, 10:47 PM   #1
aznluvsmc
Member
 
Registered: Aug 2004
Location: Newmarket, Ontario
Distribution: OpenSuse 10.2
Posts: 184

Rep: Reputation: 30
Cannot chroot


Hi,

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.

Thanks for the help!
 
Old 04-06-2005, 01:36 AM   #2
titopoquito
Senior Member
 
Registered: Jul 2004
Location: Lower Rhine region, Germany
Distribution: Slackware64 14.2 and current, SlackwareARM current
Posts: 1,646

Rep: Reputation: 146Reputation: 146
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?
 
Old 04-06-2005, 09:34 AM   #3
aznluvsmc
Member
 
Registered: Aug 2004
Location: Newmarket, Ontario
Distribution: OpenSuse 10.2
Posts: 184

Original Poster
Rep: Reputation: 30
The command is

># chroot <space> /jail <space> /export/srv/www/apache2/bin/httpd

All directories needed for the jail to run are there includig all dynamic dependancies.
 
Old 04-06-2005, 03:44 PM   #4
Robert G. Hays
Member
 
Registered: Jan 2003
Location: Atlanta, Ga., USA
Distribution: Gentoo, Mandrake, ~others
Posts: 157

Rep: Reputation: 30
aznluvsmc


I think you need to delete that second space; I have no idea why it should be in there, and I have used chroot several times.

IIRC, *then* you need the rest of the line again to run your app/svc.

HTH,
 
Old 04-06-2005, 08:37 PM   #5
aznluvsmc
Member
 
Registered: Aug 2004
Location: Newmarket, Ontario
Distribution: OpenSuse 10.2
Posts: 184

Original Poster
Rep: Reputation: 30
So from what you're saying the command should be:

chroot /jail/export/srv/www/apache2/bin/httpd /export/srv/www/apache2/bin/httpd


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.
 
Old 04-06-2005, 09:18 PM   #6
aznluvsmc
Member
 
Registered: Aug 2004
Location: Newmarket, Ontario
Distribution: OpenSuse 10.2
Posts: 184

Original Poster
Rep: Reputation: 30
Hi,

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.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
chroot help Smokey Slackware 15 02-24-2013 11:32 PM
sudo /usr/bin/chroot /home/chroot /bin/su - xxx| /bin/su: user xxx does not exist saavik Linux - General 3 07-04-2007 10:30 AM
chRoot SpaceCadet Linux - Networking 3 08-14-2003 05:29 AM
Chroot chamkila Linux - General 1 06-13-2003 05:46 AM
Better than chroot? radnix Linux - Security 5 12-20-2002 06:55 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 05:34 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration