Knowledgebase

Sharing more directories with single user account over CageFS

In a shared hosting environment, CageFS is designed to provide a virtualized file system for each user, ensuring they can only access their own files. However, there might be scenarios where you need to share additional directories with a specific user.

To do this, you'll need to selectively mount directories from the main system into the user's CageFS environment. Here's a general outline of the steps:

  1. Identify Directories to Share:

    • Determine which directories you want to share with the user. Ensure that they are secure and don't contain sensitive or system-critical information.
  2. Mount Directories into CageFS:

    • You'll need to mount the directories you've identified into the user's CageFS environment.

    • For example, if you want to share /shared_directory with the user, you would use a command like:

      bash

 

    • mount --bind /shared_directory /home/user_username/cagefs-shared-directory
      • Replace /shared_directory with the actual directory path you want to share.
      • Replace /home/user_username with the home directory of the user.
      • Create a new directory  cagefs-shared-directory inside the user's home directory.
  • Add the Mount Point to CageFS:

    • Edit the CageFS mount point configuration file to include the newly shared directory:

      bash
    • echo "/home/user_username/cagefs-shared-directory" >> /etc/cagefs/cagefs.mp
    • This ensures that CageFS includes this directory in the virtualized environment for the user.

  • Reinitialize CageFS:

    • After making changes to the CageFS configuration, you'll need to reinitialize CageFS for the changes to take effect:

      bash

 

    • cagefsctl --force-update
  1. Verify Access:

    • Log in as the user and check if they can access the shared directory.
  2. Set Permissions (if necessary):

    • Make sure that the permissions for the shared directory within CageFS are set correctly so that the user can access it.

Remember to carefully consider the security implications of sharing directories in this way. It's important to ensure that shared directories do not contain sensitive or critical system files. Additionally, always have a backup of your data and configurations before making significant changes to your server.

 
 
 
  • 0 Users Found This Useful
Was this answer helpful?