Skip to content

CageFS — why every shared cPanel host should have it on

CageFS gives each cPanel user a separate virtual filesystem view, isolating processes, hiding other users, and stopping cross-tenant data exposure. Here is what it does and how to verify it is intact.

CageFS is the part of CloudLinux that makes shared hosting actually safe. Each cPanel user gets their own virtual root: their own /etc, their own /tmp, their own view of /proc that hides other users’ processes. Without CageFS, a tenant with a vulnerable PHP script can read every other tenant’s wp-config.php; with CageFS, the tenant cannot even see that the other tenants exist. We do not run shared cPanel hosts without CageFS, and we audit it on every takeover.

What’s happening

CageFS chroots each user into a per-user skeleton built from a base template at /usr/share/cagefs-skeleton. Files outside the skeleton are either bind-mounted in read-only from the host (binaries, libraries) or invisible. /proc is filtered so a user only sees their own PIDs. /tmp is per-user, so one tenant’s session files cannot be read by another. The cage activates on every PHP request, SSH session, and cron job for that user.

The performance angle: CageFS adds a small per-process startup cost (the cage has to be set up), but in exchange you can confidently pack more tenants per host because they cannot interfere with each other. Without it, the only safe-shared-host strategy is “fewer customers per box”, which is more expensive than CageFS.

How to verify

Confirm CageFS is enabled and active:

cagefsctl --display-user-mode <username>
cagefsctl --check
cagefsctl --list-enabled-users | wc -l

If a specific user is showing problems (custom binary not found, cron failing), check whether they are inside the cage:

sudo -u <username> cat /etc/passwd | head -3
sudo -u <username> ls /home/

Inside the cage, /etc/passwd should show only that user, root, and a few system accounts; /home/ should show only that user’s home. If the user sees other tenants’ home directories, the cage is not enforced for them.

The fix

If CageFS is off entirely:

cagefsctl --init
cagefsctl --enable-all
cagefsctl --remount-all

If a specific user is not caged but should be: cagefsctl --enable <username> && cagefsctl --force-update.

If a customer needs a custom binary inside the cage (the most common support case), add it to the skeleton:

cagefsctl --addrpm <package-name>
cagefsctl --force-update
cagefsctl --remount-all

Or for a file that is not part of an RPM, copy it into /etc/cagefs/conf.d/ configuration and re-run the update. Avoid editing the cage skeleton directly — the next cagefsctl --update will revert it.

After a CloudLinux kernel update, always remount the cage: cagefsctl --remount-all. A stale cage is the most common post-update incident. Stack Harbor maintains CageFS skeletons as part of cPanel/WHM management.