Community Forums
Connect with us on LinkedIn
Community Notice
+ Reply to Thread
Results 1 to 13 of 13
  1. #1
    Member
    Join Date
    Aug 2007
    Posts
    23

    Default How to remove virtfs and disable jailshell completely

    Hello,

    I want to remove /home/virtfs. I know that it consists of hardlinks to actual system files, and I shouldn't do a rm -rf. Currently I don't have any users which have jailed shell enabled, but there is still one /home/virtfs/user directory. And I want to disable jailed shell completely, so that other administrators, resellers, or whoever who can enable it now won't be able to do enable then.

    And, just out of curiosity, how can virtfs hardlinks span multiple partitions? My /home partition is completely separate from /, /usr, /var, /tmp, but they all refer to the same data: I tried to create a /tmp/testfile and it shoed up as /home/virtfs/user/tmp/testfile.

    PS. Excuse me for starting one more thread, but I have searched the forum, and I didn't find any definite solution, just some bizarre "it might work" suggestions, like chown'ing /home/virtfs.
    Last edited by gribozavr; 08-28-2007 at 08:28 AM.

  2. #2
    Member
    Join Date
    Aug 2007
    Posts
    53

    Default

    I would like to do the same thing. Anyone?

    I want to get rid of the virtfs entry.

    root@server4 [/]# find / -name ef8cou -print
    /home/virtfs/ef8cou
    /home/virtfs/ef8cou/var/spool/mail/ef8cou
    /home/virtfs/ef8cou/home2/ef8cou
    /home2/ef8cou
    /etc/proftpd/ef8cou
    /var/cpanel/users/ef8cou
    /var/cpanel/bandwidth/ef8cou
    /var/cpanel/lastrun/ef8cou
    /var/spool/mail/ef8cou

  3. #3
    cPanel Partner NOC cPanel Partner NOC Badge AndyReed's Avatar
    Join Date
    May 2004
    Location
    Minneapolis, MN
    Posts
    2,223

    Default

    The /home/Virtfs Directory is created for users with Jailshell. Virtfs is hardlinked to some system files. If you delete the files in virtfs, you delete the actual system files they're linked to; that's very bad idea. The asiest way to is to go through the list of users in WHM >> Manage Shell Access and disable Jailed Shell for users.

    For more information you can refer http://www.prongs.org/virtfs/docs/virtfs.pdf
    Andy Reed
    RHCE and CCNA
    ServerTune.com

  4. #4
    Member
    Join Date
    Mar 2006
    Location
    Brno, Czech Republic
    Posts
    507

    Default

    don't delete virtfs. just disable from cpanel. if still stays there, try rebooting, if still there, just leave it there, you have nothing to be concerned of.
    Not everything that is counted counts and not everything that counts can be counted

  5. #5
    Member
    Join Date
    Sep 2002
    Posts
    580

    Default

    you have nothing to be concerned of.
    Yes, you have, because the space in /home/virtfs/user is counted towards the users quota.

    I would like to see a solution for this too.

    None of our users has jailshell but these dirs keep appearing.

  6. #6
    Registered User
    Join Date
    Sep 2007
    Posts
    1

    Default

    I have the same problem, lots of virtfs directories taking up disk space when no users have jail shell enabled.

    I am using WHM 11.11.0 cPanel 11.16.0-S18450

    Our older server is running WHM 10.8.0 cPanel 10.9.0-S9966 and doesn't have this problem at all.

  7. #7
    cPanel Development cpanelkenneth's Avatar
    Join Date
    Apr 2006
    Posts
    3,766
    cPanel/Enkompass Access Level

    Root Administrator

    Default

    This is a quick piece, might have some errors, but should give you a better picture of virtfs.


    The contents of virtfs are generally bind mounts, not hard links.

    What I typically do is loop through each directory in /home/virtfs/user, issuing umount on each. Note the umount is issued against the contents of /home/virtfs/user, not /home/virtfs. I think there are one or two mounts nested below /home/virtfs/user. Once all the mounts are taken care off, the remaining files should be copies made for the purpose of jailshell. For example /home/virtfs/user/etc/passwd is only a subset of /etc/passwd, with enough info for the system and user.

    To get an idea of what is bind mounted, create a test account with jailshell access and login via SSH. Once logged in, execute the mount command. You should get a list like:

    Code:
    /dev/root on /lib type virtfs (defaults)
    /dev/root on /usr/include type virtfs (defaults)
    /dev/root on /usr/lib type virtfs (defaults)
    /dev/root on /usr/sbin type virtfs (defaults)
    /dev/root on /usr/share type virtfs (defaults)
    /dev/root on /usr/bin type virtfs (defaults)
    /dev/root on /usr/X11R6 type virtfs (defaults)
    /dev/root on /usr/local/bin type virtfs (defaults)
    /dev/root on /usr/local/lib type virtfs (defaults)
    /dev/root on /usr/local/share type virtfs (defaults)
    /dev/root on /usr/local/Zend type virtfs (defaults)
    /dev/root on /usr/kerberos type virtfs (defaults)
    /dev/root on /usr/libexec type virtfs (defaults)
    /dev/root on /usr/man type virtfs (defaults)
    /dev/root on /var/log type virtfs (defaults)
    /dev/root on /var/spool type virtfs (defaults)
    /dev/root on /var/lib type virtfs (defaults)
    /dev/root on /var/run type virtfs (defaults)
    /dev/root on /tmp type virtfs (defaults)
    /dev/root on /dev type virtfs (defaults)
    /dev/root on /bin type virtfs (defaults)
    /dev/root on /home34y69da/bug6285 type virtfs (defaults)
    These are all the bind mounts.

    Once all the mounts are removed, if you want to determine whether the remaining files are hard links or local copies, then execute touch on the file/directory and compare the timestamps for before and after the 'touch' For example:


    Code:
    os103qa:~ # ln /etc/exim.pl.local exim.pl.local
    os103qa:~ # ls -la exim.pl.local
    -rwxr-xr-x 2 root root 23178 Jan 16 21:49 exim.pl.local
    os103qa:~ # ls -la exim.pl.local /etc/exim.pl.local
    -rwxr-xr-x 2 root root 23178 Jan 16 21:49 /etc/exim.pl.local
    -rwxr-xr-x 2 root root 23178 Jan 16 21:49 exim.pl.local
    os103qa:~ # touch exim.pl.local 
    os103qa:~ # ls -la exim.pl.local /etc/exim.pl.local
    -rwxr-xr-x 2 root root 23178 Jan 18 06:03 /etc/exim.pl.local
    -rwxr-xr-x 2 root root 23178 Jan 18 06:03 exim.pl.local
    A hard link will update both, while a local copy will only update the one. It is safe to remove a hard-linked file:

    Code:
    os103qa:~ # rm exim.pl.local 
    os103qa:~ # ls -la exim.pl.local /etc/exim.pl.local
    ls: cannot access exim.pl.local: No such file or directory
    -rwxr-xr-x 1 root root 23178 Jan 18 06:03 /etc/exim.pl.local
    Removing a file that is part of the bind mount is not recommended though as it removes the original. The touch test will behave the same for a bind mounted accessible files as for a hard linked file, so it's not exactly fool-proof.

  8. #8
    Member
    Join Date
    May 2002
    Posts
    9

    Default is jailshell secure?

    Quote Originally Posted by AndyReed View Post
    For more information you can refer http://www.prongs.org/virtfs/docs/virtfs.pdf
    I have read this and now I have a question.
    Is cpanel jailshell secure?

    In mentioned pdf described how to create template in /virtual/template and than make hardlinks /virtual/user1/file to /virtual/template/file

    But in cpanel I see hardlinks to REAL files like /bin/bash

    So, if user in jailshell got root privileges he will be able to compromise the entire server.

    Am I wrong?
    Volodymyr Petrov
    www.Hostizer.com

  9. #9
    Member
    Join Date
    Aug 2007
    Posts
    10

    Default

    Hi,

    AndyReed is right, If you remove virtfs accidentally you need to reload your OS. Not advisable....

  10. #10
    Member
    Join Date
    Sep 2002
    Posts
    580

    Default

    Is it possible to disable quotas on the /home/virtfs dir?

    That would "fix" it too.

  11. #11
    Member
    Join Date
    Mar 2007
    Posts
    29

    Default

    Is it possible to remove the virtfs directory after u-mounting the virtual chroot environment ?

    I had u-mounted all the /home/virtfs resides on /proc/mounts and the file space decreased to 2.1M. I'd simply like to remove all the directory now. Is it safe?

    Thank you.

  12. #12
    Member
    Join Date
    Mar 2010
    Posts
    7

    Default

    Hello

    you can remove it with this

    if you type

    PHP Code:
    cat /proc/mounts 
    you will some thing like this ..
    PHP Code:
    /dev/root /home/virtfs/usershell/usr/local/IonCube ext3 rw,data=ordered,usrquota 0 0
    /dev/root /home/virtfs/usershell/usr/include ext3 rw,data=ordered,usrquota 0 0
    /dev/root /home/virtfs/usershell/usr/local/lib ext3 rw,data=ordered,usrquota 0 0
    /dev/root /home/virtfs/usershell/var/spool ext3 rw,data=ordered,usrquota 0 0
    /dev/root /home/virtfs/usershell/var/lib ext3 rw,data=ordered,usrquota 0 0
    /dev/root /home/virtfs/usershell/var/cpanel ext3 rw,data=ordered,usrquota 0 0
    /dev/root /home/virtfs/usershell/usr/local/cpanel/Cpanel ext3 rw,data=ordered,usrquota 0 0
    /dev/root /home/virtfs/usershell/var/run ext3 rw,data=ordered,usrquota 0 0
    /dev/root /home/virtfs/usershell/var/log ext3 rw,data=ordered,usrquota 0 0
    /dev/sda6 /home/virtfs/usershell/tmp ext3 rw,nosuid,noexec,data=ordered 0 0
    /dev/root /home/virtfs/usershell/bin ext3 rw,data=ordered,usrquota 0 0
    /dev /home/virtfs/usershell/dev tmpfs rw 0 0
    /proc /home/virtfs/usershell/proc proc rw 0 0
    /dev/root /home/virtfs/usershell/home/usershell ext3 rw,data=ordered,usrquota 0 0 

    so .. to unmount and then remove it .. do this

    PHP Code:
    /scripts/clear_orphaned_virtfs_mounts
    for i in `cat /proc/mounts | grep /home/virtfs | cut -d ' ' -f 2 ` ; do umount $i done 

    you can see

    cPanel JailShell, Unmount and Clean Virtfs | Control Panel Blog
    VirtFS < AllDocumentation/WHMDocs < TWiki


    Hamdi Mershed
    Al-Ra3eD.CoM
    Al-Ra3eD.CoM
    Internet Services - Security - Servers Management - Best solutions
    Xen VPS From 9$ On Live Chat Now

  13. #13
    Member
    Join Date
    Mar 2007
    Posts
    29

    Default

    Thanks dude for your reply.

    But, the question was, Is it safe to remove the virtfs directory after getting it u-mounted?

Similar Threads & Tags
Similar threads

  1. How to completely remove/disable Cpanellogd ?
    By sabater_wb in forum cPanel and WHM Discussions
    Replies: 3
    Last Post: 06-01-2011, 04:18 PM
  2. How do I completely disable jailshell and get rid of /home/virtfs
    By hostultra in forum cPanel and WHM Discussions
    Replies: 4
    Last Post: 07-14-2009, 12:31 PM
  3. JailShell and VirtFS
    By emarton in forum cPanel and WHM Discussions
    Replies: 1
    Last Post: 06-16-2009, 02:58 PM
  4. Deleted /home/virtfs! Completely Screwed. Help!
    By yong in forum cPanel and WHM Discussions
    Replies: 3
    Last Post: 07-30-2007, 12:09 PM
  5. Jailshell, virtfs, & quota's...oh my
    By Ben in forum cPanel and WHM Discussions
    Replies: 20
    Last Post: 07-31-2004, 01:03 PM
Linkedin       Facebook       Twitter       RSS       Flickr       YouTube