Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I'm running Ubuntu, with PHP5-FPM, mysql & Nginx

I've just setup a chrooted jail with jailkit. Now I need to work out how to setup my php and mysql to work within the jail.

Google search doesn't give me much, and there's no documentation for this on the jailkit website. (It may be easy but I'm fairly new to this field)

share|improve this question

2 Answers 2

Here is a sample configuration section that you can put in /etc/jailkit/jk_init.ini so that future jail adds are seamless.

I used this section

[mysql-client]
comment = mysql client
executables = /usr/bin/mysql
paths = /usr/lib/libmysqlclient.so.16.0.0 , /usr/lib/libmysqlclient.so.16, /usr/lib/libstdc++.so.6,/usr/lib/libstdc++.so.6.0.13,/lib/libgcc_s.so.1

Seemed to work well, you may need to change some paths. jailkit MAY resolve the symlink paths on its own but i added both in case.

Two caveats

1) Users must use full mysql -h syntax (mysql -h basehostname database) since you do not have the mysql local sockets in the jail

2) Your mysql must be listening on the public interface so the jail can connect to it.

share|improve this answer
up vote 1 down vote accepted

Figured it out anyhow!

Just find out where the php & mysql binaries reside (/user/bin or /user/sbin) and copy them to the relative chroot directory. Then when you run the php command from the chroot user you'll get an error saying such and such a libary is missing so then you've just got to find that libaray and copy it into the relative chroot directory and keep going like that until all the dependant libraries have been copied over.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.