How to mange VirFS on cpanel server

How to manage VirtFS on cPanel server

What is Virtfs in cpanel ? How it is created ?

The /home/virtfs is a file system for the jailshell shell in cPanel servers. A jailed shell  is used for restricting the access for the user. In a normal shell most binaries and libraries are available to user. It can cause security issues on your server. The purpose of jailed shell is to provide limited and restrictive environment to the user which is more secure to the server.

When a user logs in to a jailed shell environment via SSH or SFTP for the first time, the system creates the /home/virtfs/ directory. The user can (only) access the data under these file-systems. The disk usage for the directory will be shown as high but it will not use any disk space on the server because it is a virtual mount point.If you delete any file in this directory it will delete the actual file which is linked to.

The virtfs files are actually  hard-links to the actual files under the user. That means both the files are using the same inode number.  For example


The image shows the files (with inode number) under the virtfs directory for the user.  Here the index. php have the inode number 30283170.

The below image shows the files under users public_html directory


All the files have the same inode number.  So If you are attempting to delete the files under virtfs directory directly then the actual file also will be removed from the server which may cause issues.

To disable jailed shell access in WHM

 Login to WHM

 WHM >> Account Functions >> Manage Shell Access

Here we can see the option to disable jailed shell access for specific user.

cPanel provides a script to remove the virtfs mounts

#/scripts/clear_orphaned_virtfs_mounts –clearall

You can verify it by using the command

grep -i username /proc/mounts

How to remove virtfs directory

Please do not remove the virtfs files directly since it is a hard-link to the actual file.  Deleting the files may cause issues on the server.

To resolved this issue go through the below steps :

Step 1 : You can check un-realise mount point for that user using below command.

# cat /proc/mounts | grep username

This shows mount point still remain for that user.

Step 2 : Kill the jailshell process related to that user.

# ps aufx |grep username  |grep jailshell

Please make sure that the specified user is not logged in via SSH.

Step 3 : Finally unmount all the files related to that user

# for i in `cat /proc/mounts |grep virtfs |grep username |awk '{print$2}'`; do umount $i; done

Verify once that all mount point for that user are release using the command given in step 1.

Step 4 : If there isn’t any mount point you are free to delete those files.

# rm -rf /home/virtfs/username

We can disable the Jailed shell from WHM if the user doesn’t need it.


Now you have learned about Virtfs in cPanel, how it is created and how to properly remove virtfs directory without removing the actual file from the server. 

Experts at Nixtree offers comprehensive cPanel Server Management services and a wide range of server administration works pertaining to cPanel and cPanel servers. cPanel Server Management is our major forte and we have expertly trained NixAdmins exclusively for cPanel support.

Subscribe to our Server Management services now, to leverage our quality, uninterrupted service catering to your critical requirements.

Talk to our server helpdesk support experts to fix any issues you have.

Facebook Comments