How to Enable CageFS for OpenLiteSpeed

You are here:
< Back

Enable CageFS for OpenLiteSpeed.

Before starting, please verify that CloudLinux and CageFS are properly installed and initiated:

[root@test ~]# cat /etc/redhat-release
CloudLinux release 7.6 (Vladimir Lyakhov)
[root@test ~]# /usr/sbin/cagefsctl --display-user-mode
Mode: Disable All

Step 1

Log into the WebAdmin Console via https://IP:7080. Navigate to Server Configuration > General > Server Process. Set CloudLinux to CageFS, save, and restart OpenLiteSpeed.

Step 2

Add the user into CageFS with this command, making sure to replace example with your PHP userid:

[root@test ~]# /usr/sbin/cagefsctl --enable example
Updating users ...

And that’s it!

How to Verify if CageFS Works

For demonstration purposes, create a test.txt outside of the user home folder.

[root@test ~]# echo "CageFS test" > /test.txt
[root@test ~]# cat /test.txt
CageFS test

Create a PHP file to read it:

cat > /home/ << 'EOF'
$myfile = fopen("/test.txt", "r") or die("Unable to open file!");
echo fread($myfile,filesize("test.txt"));
[root@test ~]# curl -XGET
CageFS test

Enable CageFS options in the WebAdmin Console and restart OpenLiteSpeed.

[root@test ~]# curl -XGET
Unable to open file!