Skip to main content

SOLVED - Extending chroot jail or removing it

Answered

Comments

2 comments

  • JAB Creations

    SOLVED

    Detecting chroot for PHP required running PHP's sleep(30) (30 seconds) as the command only detects chroot processes that are running by this command:

    for file in `find /proc/ -type l -name "root" -print 2> /dev/null | grep -Eiv /task/ 2> /dev/null`; do PID=`ls -d $file 2> /dev/null| awk -F "/" '{print $3}'` && printf "%s = %s = %s\n" "$PID" `ps -p "$PID" 2> /dev/null | tail -n1 | awk '{print $4}'` `readlink $file 2> /dev/null` | grep -Eiv "(= /$|^\s*=\s*$|^.*?=\s*$)";done

    Which is referenced at this cPanel URL:
    https://support.cpanel.net/hc/en-us/articles/1500012454701-How-To-Find-The-List-Of-All-The-Chroot-ed-Processes-On-The-System

    Trying to figure out how chroot was integrated in SSH/PuTTY logged in as root I ran the following command:

    find / -name '*chroot*'

    Many of the results included file system paths like:

    /usr/share/cagefs-skeleton/usr/

    Eventually I went to WHM and looked specifically for cagefs which is listed under Plugins.

    On the cagefs plugin page the jabcreat Linux user (used by PHP) was listed. I removed it and updated the cagefs plugin. I reloaded my custom built Control Panel and confirmed the chroot error was no longer occurring.

    Please make note of PHP functions like shell_exec() and file_get_contents not working and not finding files can be a result of having chroot / cagefs installed and enabled for the Linux user PHP uses.

    The idea of chroot is good but no function is worth jack-diddly unless it allows you to easily: index, create, edit and delete which it does not! This problem destroyed five of my work days so I hope this helps someone else out who is struggling with the same BS.

    0
  • cPRex Jurassic Moderator

    I'm glad you were able to find a good solution, and thanks for sharing it!

    0

Please sign in to leave a comment.