custom mount only for some cagefs users
Forum
  1. Forums
  2. CloudLinux and Control Panels
  3. CloudLinux and cPanel
  1. Havri
  2. Wednesday, 23 May 2018
  3.  Subscribe via email
Hello,

Is there a way to mount a dir from the server on a custom mount point for certain users? Basically, I have a directory on my host named /custom_dir/. This directory contains folder for each user. My users are user111, user222, user333 and so on.

What I would like to is to mount each of these folder to their correspondent user.



[[email protected]_server ~r]# tree /custom_dir
/custom_dir/
├── user111
│   ├── folder1
│   │   └── user111.my_file.txt
│   └── folder2
│   └── user111.my_file.txt
├── user222
│   ├── folder1
│   │   └── user222.my_file.txt
│   ├── folder2
│   │   └── user222.my_file.txt
│   └── folder3
│   └── user222.my_file.txt
├── user333
│   └── folder1
│   └── user333.my_file.txt
└── user444
├── folder1
│   └── user444.my_file.txt
├── folder2
│   └── user444.my_file.txt
├── folder3
│   └── user444.my_file.txt
└── folder4
└── user444.my_file.txt

14 directories, 10 files



So far, I've managed to mount the /custom_dir/ for each user at the same mountpoint (so /custom_dir/userXXX can be accessed by each user if they access /custom_dir/userXXX).

What I really want is for user111 to mount /custom_dir/user111 from the host to /home/user111/custom_dir, so that it can be accessible from the user's homedir. For user222 --> mount /custom_dir/user222 from the host to /home/user222/custom_dir and so on for user333 and user444.

Is this possible? It there a workaround?

I've also tried the methods from the following links, but I didn't manage to get this solved:

https://docs.cloudlinux.com/index.html?split_by_username.html


https://docs.cloudlinux.com/index.html?per_user_virtual_mount_points.html


Thank you.
Rate this post:
  1. 18.07.2018 22:07:16
  2. # 1
Aleksei Faians Accepted Answer
Posts: 21
Joined: 02.04.2018
0
Votes
Undo
Hello,

CageFS supports this out-of-the-box. All you need to do is add the following line to /etc/cagefs/cagefs.mp:

%/custom_dir

And then execute:

cagefsctl --remount-all


Please note that it will work only for users with CageFS enabled. Please read more about CageFS in our documentation:https://docs.cloudlinux.com/index.html?cagefs.html

If you need additional help, please do not hesitate to open a ticket with our support team.
  1. 18.07.2018 22:07:24
  2. # 2
Aleksei Faians Accepted Answer
Posts: 21
Joined: 02.04.2018
0
Votes
Undo
I apologize, if you want these directories to be accessed by different paths, you'll need to additionally create symbolic links to these folders, for example:

ln -s /custom_dir/user111 /home/user111/custom_dir
  1. 24.08.2018 10:08:35
  2. # 3
Havri Accepted Answer
Posts: 0
Joined: 21.10.2019
0
Votes
Undo
Hello,

So basically what I have to do is create symlinks on the host for each user? That's not actually a CageFS function, but rather a simple symlink. Doesn't CageFS have a function where I can mount custom mount points for each user at each CageFS reinitialization?

Like I said in the previous post, I tried the following from this page:

https://docs.cloudlinux.com/index.html?per_user_virtual_mount_points.html

The example there is quite confusing and I can't figure out the proper syntax without another example.

Therefore I'll need an example with the following:

for user1:

mount /custom_dir1/my_dir1/php.ini from the host inside cagefs to let's say /opt/alt/php70/etc/php.ini - this file has to be able to be edited from the host and the changes should be reflected inside user's cagefs after issuing cagefsctl --force-update or cagefsctl --remount-all

for user2:

mount /custom_backups/user2 from the host to /home/user2/my_custom_backup_dir inside user's cagefs without making symlinks on the host or through /etc/fstab on the host.

Let me know if any of this is possible. Looking forward to your response.

Thank you.
  1. 31.08.2018 14:08:02
  2. # 4
Aleksei Faians Accepted Answer
Posts: 21
Joined: 02.04.2018
0
Votes
Undo
Yes, this is a symlink, but CageFS will perform virtualization of directories inside /custom_dir/, so each user will only see their own directory. CageFS does not support automatic mounting directories the way you want it. Article https://docs.cloudlinux.com/index.html?per_user_virtual_mount_points.html describes how to virtualize folders inside user's home folders, which is used mostly with Plesk folder structure, you can see example at the bottom of the article. This method still does not allow to mount /custom_dir/user111 to /home/user111/custom_dir, because it is not a virtualization, it is some kind of path remapping, and CageFS does not have an option to do that automatically.
  • Page :
  • 1


There are no replies made for this post yet.
Be one of the first to reply to this post!
Guest
Submit Your Response
Upload files or images for this discussion by clicking on the upload button below. Supports gif,jpg,png,zip,rar,pdf
• Insert • Remove Upload Files (Maximum File Size: 2 MB)
Captcha
To protect the site from bots and unauthorized scripts, we require that you enter the captcha codes below before posting your question.