Tag: cagefs

  • CageFS make Node.js available to all users by default

    CageFS make Node.js available to all users by default

    On CloudLinux server, when you install alt-nodejs packages, binary files get installed at

    /opt/alt/alt-nodejs16/root/bin/node
    

    When SSH into a user and run the command “node”, it won’t work. When deploying Node.js application with Cpanel, you will be given a command, that is used to switch to the environment with specific version of node.js the application is using.

    If you want to make node.js available to all users by default, even with out a node.js application configured, you do the following

    ln -s /opt/alt/alt-nodejs16/root/bin/node /usr/bin/node
    ln -s /opt/alt/alt-nodejs16/root/bin/npm /usr/bin/npm
    ln -s /opt/alt/alt-nodejs16/root/bin/npx /usr/bin/npx
    

    This will make “alt-nodejs16” as the default Node.js, if you need to use another version of Node.js default, change the paths as required. If you don’t have it installed, install it with

    yum install -y alt-nodejs16
    

    Create file

    vi /etc/cagefs/conf.d/node.cfg
    

    Add following content

    [node]
    comment=Node
    paths=/usr/bin/node, /usr/bin/npm, /usr/bin/npx
    

    Update CafeFS and remount all users

    cagefsctl --force-update
    cagefsctl -M
    

    Now Node.js will be available to all users by default.

    Back to CageFS

  • CageFS command not working for user

    I have flvtool2 installed on the server. Path to binary file location was added in file /etc/cagefs/conf.d/vshare.cfg

    [root@server22 ~]# cat /etc/cagefs/conf.d/vshare.cfg 
    [vshare]
    comment=vShare Youtube Clone Requirements
    paths=/usr/bin/ffmpeg, /usr/bin/mencoder, /usr/bin/mplayer, /usr/bin/flvtool2, /usr/bin/lame, /usr/bin/yamdi, /usr/bin/qt-faststart, /usr/bin/MP4Box, /usr/bin/mediainfo, /usr/bin/neroAacEnc
    [root@server22 ~]# 
    

    The binary program works properly when running as root, but it fail when switching to a user that use CageFS.

    [root@server22 ~]# /usr/bin/flvtool2 -V
    FLVTool2 1.0.6
    [root@server22 ~]# su - socialwe
    Last login: Thu May 28 06:33:33 UTC 2020 on pts/0
    [socialwe@server22 ~]$ /usr/bin/flvtool2 -V
    :1:in `require': cannot load such file -- rubygems.rb (LoadError)
    from :1:in `'
    [socialwe@server22 ~]$
    

    The problem is fixed by editing file /etc/cagefs/cagefs.mp

    vi /etc/cagefs/cagefs.mp
    

    Add following lines

    !/usr/lib64/ruby/
    !/usr/share/rubygems/
    !/usr/share/ruby/
    !/usr/local/share/ruby/
    

    Now remount cagefs with

    cagefsctl --remount-all
    

    See cagefs

  • cagefsctl

    Enable CafeFS for all cpanel users

    cagefsctl --enable-all