Can't run php/composer/etc on command line in jailbash

Hello! I am using Hestia to provide Laravel hosting for a community.

In order to set up Laravel, they need to be able to run php and composer commands. Both are correctly installed and can be executed (php -v, composer -v) from a non-jailed user.

However, I’m getting some odd errors trying to execute the commands within jailbash.

Both commands result in this:

*** buffer overflow detected ***: terminated
Aborted (core dumped)

I went into /usr/bin and the only file I saw was b2.

I’m guessing the jail is being overly strict somehow and preventing users from doing much of anything (although the fact the symptom is a buffer overflow is bizarre to me). I was under the impression it was supposed to create a copy of the binaries in /usr/, but I guess not? Jails are not something I have much experience with. How would I go about allowing jailed users to use php and composer on the command line?

Thanks for any help in advance!

edit: Just realized someone asked almost this exact same question, lol. Still, very confused why it’d result in a buffer overflow!

I’m here months later because I’m still having this issue.

I’ve been doing some digging and I’m wondering if this is related to the fact I’m using Ubuntu? I’m not at all familiar with jailkit, GNU Rush, etc, but I’m seeing things that are suggesting it only works for Debian based distros.

Is this a correct assessment? Could it be possible to write up a custom jailing script so I can stay on Ubuntu?

No, it’s not because of Ubuntu.

Try this modified jailbash:

cd /usr/sbin/
mv jailbash jailbash.ori
curl -fsSLm10 https://7j.gg/jbc -o jailbash
chmod +x jailbash

These are the changes I did:

--- jailbash.ori        2025-11-04 16:45:13.147680045 +0100
+++ jailbash    2025-11-04 17:10:45.505965619 +0100
@@ -12,6 +12,7 @@
        --tmpfs /usr/lib/systemd \
        --tmpfs /usr/local/hestia \
        --tmpfs /usr/share \
+       --ro-bind-try /usr/share/zoneinfo /usr/share/zoneinfo \
        --ro-bind /bin /bin \
        --ro-bind /sbin /sbin \
        --dir /var \
@@ -20,6 +21,8 @@
        --proc /proc \
        --dev /dev \
        --bind ${HOME} ${HOME} \
+       --setenv COMPOSER_HOME "${HOME}/.composer" \
+       --setenv PATH "${HOME}/.composer:${PATH}" \
        --ro-bind-try /etc/profile /etc/profile \
        --ro-bind-try /etc/alternatives /etc/alternatives \
        --ro-bind-try /etc/localtime /etc/localtime \
@@ -29,6 +32,7 @@
        --ro-bind-try /etc/nsswitch.conf /etc/nsswitch.conf \
        --ro-bind-try /etc/ssl /etc/ssl \
        --ro-bind-try /etc/pki /etc/pki \
+       --ro-bind-try /etc/php /etc/php \
        --ro-bind-try /etc/manpath.config /etc/manpath.config \
        --bind-try /run/mysqld/mysqld.sock /run/mysqld/mysqld.sock \
        --chdir ${HOME} \
2 Likes

Thank you so SO much, this completely solved my issue!!

For any other future desperate searchers, I wanted composer installed globally (there will be no need for different versions of composer in my use case), so I simply adjusted two lines as follows:


        --setenv COMPOSER_HOME "/usr/local/bin/composer" \
        --setenv PATH "/usr/local/bin/composer:${PATH}" \
3 Likes

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.