My new blog is about adding a command or binary in the CageFS. For those who doesn’t know what CageFS is, I will start with a small brief on that.
CageFS is a term related to CloudLinux and it is a virtualized file system and a set of tools to contain each user in its own ‘cage’ (can relate to chroot in Linux). Each customer will have its own fully functional CageFS, with all the system files, tools, etc.
So coming back to the topic, I will be adding FTP command to the CageFS.
First, we can check the binary ‘FTP’ and see if it’s present in the server.
root@myserver [~]# ftp ftp>
Now that command is available on the server let’s see after switching to a normal user.
root@myserver [~]# su - manu manu@myserver [~]# ftp -bash: ftp: command not found
So its confirmed that the command “ftp” is not available to the users. Now we are going to add this to CageFS so that the command becomes available to users.
You can add any RPM’s if they’re installed on the server. First, find the full path of the command using the ‘which’ command:
root@myserver [~]# which ftp /usr/bin/ftp
Once you have the full path, find out its package.
root@myserver [~]# rpm -qf /usr/bin/ftp ftp-0.17-54.el6.x86_64
Now let’s add the package/rpm to CageFS
root@myserver [~]# cagefsctl --addrpm ftp-0.17-54.el6.x86_64
You need to update CageFS so that its added to every user’s cage.
root@myserver [~]# cagefsctl --force-update
Once the command is executed, switch to a user’s account and verify that command is available.
root@myserver [~]# su - manu manu@myserver [~]# ftp ftp>
That’s all and the command ftp will be available for the user now.
Hope this blog was helpful.