Cagefs and allowing access to directories outside of root

searchmaster

Member
Jul 20, 2007
8
0
51
New Zealand
cPanel Access Level
Root Administrator
I am using cloudlinux and cagefs on a new dedicated server.

I have a cms that uses a core set of files outside of root for each client. Therefore, I can't use php open_basedir for them. I am wanting to use cagefs.

How do I set up cagefs so that the common /home/cms files can be accessed by /home/[client].

I have tried adding a cfg file
- /etc/cagefs/conf.d/cms.cfg created and cagefsctl --force-update

and have tried adding the directories to cagefs.mp

But the files are still not accessible.

Your help would be appreciated.

Thanks
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,880
2,267
463
Hello :)

The official documentation page for CageFS is available at:

CageFS Documentation

Igor (user: iseletsk) may be able to shed some more light on this issue for you, but you may also want to check out the Cloud Linux forums on their official website, as there are more Cloud Linux specific discussions there:

Cloud Linux Forums

Thank you.
 

iseletsk

Well-Known Member
Verifed Vendor
Move it somewhere outside /home (like /opt, or /usr/share)
and then you can add it.
The problem with /home is that this is where user's directories are, and as such that directory protected/we don't show anything inside that directory.
 

searchmaster

Member
Jul 20, 2007
8
0
51
New Zealand
cPanel Access Level
Root Administrator
Thanks for your advice Igor. Appreciated!

- - - Updated - - -

Of the following, which method should be used to make say /usr/share available?

Adding a cfg file
- /etc/cagefs/conf.d/cms.cfg created and cagefsctl --force-update

adding the directories to cagefs.mp

or both?
 

tommarroww

Registered
Jan 24, 2017
1
2
3
Everywhere
cPanel Access Level
Reseller Owner
This is in response to 'Cagefs and allowing access to directories outside of root' which was never answered. I would have saved quite a bit of time had I found this information:

I was having this same issue. According to the documentation and recommendation of iseletsk, your CMS files should have been made available to all users. However, it didn't work. With some digging around, I found that updating cagefsctl was not copying the files over to the '/usr/share/cagefs-skeleton/' directory. After I copied my files into that directory, all my users were able to access it and it's contents. To be more specific, this is what I did:

- Moved my CMS into '/usr/share/littletzar/'
- Created 'littletzar.cfg' file in the '/etc/cagefs/conf.d/' directory
- Added this text to the above file:
[littletzar]
comment=littletzar CMS files
path=/usr/share/littletzar
- Added the directory to the '/etc/cagefs/cagefs.mp' file as follows:
!/usr/share/littletzar
- Ran '/usr/sbin/cagefsctl --force-update'
- Copied the files over to the '/usr/share/cagefs-skeleton/' directory
-- cp -r /usr/share/littletzar/ /usr/share/cagefs-skeleton/

I hope this helps anybody who is having the same issue.
 

starchild2012

Member
Jul 24, 2012
22
2
53
cPanel Access Level
Root Administrator
This is great, but what syntax do I use to call the files?

eg
include ("/usr/share/[repo]/file.php");
?

And what user and permissions should the files be?

Many thanks.
 
Last edited:

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,880
2,267
463
This is great, but what syntax do I use to call the files?

eg
include ("/usr/share/[repo]/file.php");
?

And what user and permissions should the files be?

Many thanks.
Hello @starchild2012,

Here's a link to documentation (with an example) on adding a new file or directory to the CageFS file system template:

File System Templates

Can you let me know if this helps?

Thank you.