How to execute program in chrooted PHP-FPM? How to execute program in chrooted PHP-FPM? nginx nginx

How to execute program in chrooted PHP-FPM?


I found that copying /bin/sh to chrooted-root/bin worked. Also needed dependencies:

$ ldd /bin/sh    linux-vdso.so.1 (0x00007ffc098c6000)    libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f2e92d52000)    /lib64/ld-linux-x86-64.so.2 (0x00007f2e9331e000)

So I had to copy /lib/x86_64-linux-gnu/libc.so.6 and /lib64/ld-linux-x86-64.so.2 under my chrooted directory.

I'm not sure if it's /bin/sh under all distros, might be /bin/bash or something.