Community Forums
Connect with us on LinkedIn
Community Notice
+ Reply to Thread
Results 1 to 14 of 14
  1. #1
    Member
    Join Date
    Nov 2001
    Posts
    455

    Exclamation How to get free "unlimited" disk space for any cpanel account

    Note: This does not apply if you are running phpsuexec on your server.
    It appears to be easily possible for any cpanel account user to get free "unlimited" disk space.

    1) Create a cpanel account with a disk space limit of 5mb.

    2) Upload any PHP script that allows file uploads using html form posts.

    3) Use the script to upload files... don't stop until the drive is full.

    The files uploaded by the php script are owned by the "nobody" user, so the Cpanel quota system does not include them in the disk space usage calculation for the user. You can only see actual disk usage for a folder by clicking the "Disk Usage Viewer" utility in cpanel. If you rely on WHM or the "cpanel stats" quota system, then all the files uploaded by the php script will not be seen, and it's possible for any cpanel user to upload unlimited files with no way to know about it. Their account will never be frozen since they will never go over their cpanel account "limit".

    If anyone knows about a solution to this problem, I'm interested to know what it is. We only became aware of this after seeing the daily backups for some accounts were very large, when the actual disk usage shown by cpanel for the account was very small.

    Last edited by electric; 12-05-2006 at 01:54 AM.
    I am an eNom ETP.
    Sign up today if you want an eNom.com domain reseller account from a reliable provider.
    * We now provide support and service to over 3250 happy resellers!

  2. #2
    Member
    Join Date
    Apr 2003
    Location
    Auckland, New Zealand
    Posts
    172

    Default

    I noticed the same thing by chance last week with a customers site, they run an auction software package & the software lets those running an auction upload images as you would expect but the images etc are uploaded as nobody nobody. The owner of the site pays for 500Mb of disk space but in reality they're using about 4Gb. Worse thing is they run about 4 different specialty auction sites...we asked them to contact the software developers to see if this could be resolved and nothing as yet from them.

  3. #3
    Member
    Join Date
    Dec 2003
    Location
    France
    Posts
    300
    cPanel/Enkompass Access Level

    Root Administrator

    Default

    A crude fix could be to run a cronjob that will chown -R user.user /home/user/public_html/*

    Something like this :

    Code:
    #!/bin/bash
    cd /var/cpanel/users
    for user in *
    do
    chown -R $user.$user /home/$user/public_html/*
    done
    Marie - Co-Owner
    Need Further Assistance ? Here you go !
    English, french and spanish support

  4. #4
    Super Moderator This forum account has been confirmed by cPanel staff to represent a vendor. chirpy's Avatar
    Join Date
    Jun 2002
    Location
    Go on, have a guess
    Posts
    13,495

    Default

    That's the only way (yapluka post) you're going to work around the issue if you don't enable phpsuexec as it's a limitation of the security model of PHP and the way *nix quotas work since the files aren't and can't be owned by the user account.
    Jonathan Michaelson

    Need your cPanel servers secured and tuned?
    cPanel Server Configuration, Security, Recovery and Antivirus/AntiSpam Services
    Developers of the most effective (and free) Firewall & Security Solution for cPanel Servers - csf
    http://www.configserver.com

  5. #5
    Member
    Join Date
    May 2004
    Posts
    14

    Default

    Well....
    I see its not a new thread, but it is the answer of my question

    Now we comes to my really newbie question: How do I do that ?
    Just create the script and then drop it to /etc/cron.hourly ?
    (If I want to run the script every hour)

    Regards
    Sjat

  6. #6
    cPanel Partner NOC cPanel Partner NOC Badge
    Join Date
    Dec 2003
    Location
    Athens/GREECE
    Posts
    166
    cPanel/Enkompass Access Level

    DataCenter Provider

    Default

    Hello,

    You can run /scripts/chownpublichtmls but I don't think you should make it run every hour, because from the beginning until the end of the script all pages on the server show 403 errors (it lasts about 5 mins, I run it once per month).
    Sincerely,

    George Vardikos
    HyperHosting Internet Services

  7. #7
    Member
    Join Date
    May 2004
    Posts
    14

    Default

    Thank you for your reply
    Does that mean that I just can drop the /scripts/chownpublichtmls to /etc/cron.monthly ?
    And then it will be executed once pr month ?

  8. #8
    Member
    Join Date
    Mar 2006
    Posts
    1,215

    Default

    Quote Originally Posted by sjat View Post
    Thank you for your reply
    Does that mean that I just can drop the /scripts/chownpublichtmls to /etc/cron.monthly ?
    And then it will be executed once pr month ?
    I'm not sure you would want to run that. Last I recall is that will delete files owned by "nobody" unless that has changed, I have not looked at the script to verify.

    I would use the original script from yapluka, and yes, you can dump that into cron.hourly and it will obviously not remove access while it is running. I use it myself on 400 plus account servers every couple hours.

  9. #9
    Member
    Join Date
    May 2004
    Posts
    14

    Thumbs up

    Thank you very much.....
    You are very helpfull - I think I will try the last solution as jayh38 described.

  10. #10
    Member
    Join Date
    Dec 2003
    Location
    France
    Posts
    300
    cPanel/Enkompass Access Level

    Root Administrator

    Default

    Quote Originally Posted by sjat View Post
    Thank you very much.....
    You are very helpfull - I think I will try the last solution as jayh38 described.
    Just don't forget to give the execute permission to the script. chmod 700 will do the trick just fine
    Marie - Co-Owner
    Need Further Assistance ? Here you go !
    English, french and spanish support

  11. #11
    cPanel Partner NOC cPanel Partner NOC Badge
    Join Date
    Dec 2003
    Location
    Athens/GREECE
    Posts
    166
    cPanel/Enkompass Access Level

    DataCenter Provider

    Default

    Quote Originally Posted by jayh38 View Post
    I'm not sure you would want to run that. Last I recall is that will delete files owned by "nobody" unless that has changed, I have not looked at the script to verify.
    Hello,

    The scripts doesn't delete all files owned by nobody, it just changes the owner of the files. I'm doing it once every month in my server and no files were deleted.
    Sincerely,

    George Vardikos
    HyperHosting Internet Services

  12. #12
    Member
    Join Date
    Mar 2006
    Posts
    1,215

    Default

    Perhaps cPanel needs to update their documentation. But nevertheless, the other method is much faster and sites are always available during its run. I would get too many calls if all pages were 403 for several minutes.

    Quote from cpanel document as found here.

    chownpublichtmls - Change ownership of all users web space to them, which is useful for converting to suexec. Files owned by nobody are deleted.

  13. #13
    Member mwmconsulting's Avatar
    Join Date
    Apr 2006
    Posts
    21

    Red face Thank You!

    yapluka's fix is a beauty! Spot on for fixing this issue (which I'm surprised cPanel has not addresses personally).

    I might also suggest adding another element to this script. If you are using cPanel 10, after the chown line add

    Code:
    rm -f /home/$user/.cpanel-datastore/quota_-v
    and for cPanel 11 add

    Code:
    rm -f /home/$user/.cpanel/datastore/quota_-v
    This addition will ensure that the disk usage information displayed on the cPanel page will be up-to-date when the user next visits their cPanel (as the deleted quota_-v file will automatically be recreated with the updated information). Ordinarily, I'm told the cpanel information is refreshed every 24 hours so this step is not mandatory just beneficial.

    Lastly, for those of you who implement Menalto's Gallery (http://gallery.menalto.com), you'll also need to chown all the files in the user's gallery albums directory (as they too are owned by "nobody").
    ========================
    MWM Consulting, Inc.
    InSiteful Business Solutions
    http://www.mwmconsulting.biz
    ========================

  14. #14
    Member
    Join Date
    Apr 2003
    Location
    Denver, CO
    Posts
    294

    Default

    What about these types of messages where the disk quota is exceeded and it won't chown?

    chown: changing ownership of `/home/someone/public_html/gallery/g2data/cache/module/customfield/0/1/14.inc': Disk quota exceeded

Similar Threads & Tags
Similar threads

  1. WSO Stats - "Disk Space"
    By cPanelSalinas in forum Enkompass Discussions
    Replies: 1
    Last Post: 08-22-2011, 03:27 PM
  2. "disk used" only calculating MySQL Disk Space..
    By damainman in forum Database Discussions
    Replies: 1
    Last Post: 05-25-2010, 09:02 AM
  3. "disk used" only calculating MySQL Disk Space..
    By damainman in forum cPanel and WHM Discussions
    Replies: 1
    Last Post: 05-25-2010, 09:02 AM
  4. "Disk Space Usage" Fatal Error (v.11)
    By BPmedia-David in forum cPanel and WHM Discussions
    Replies: 10
    Last Post: 06-09-2007, 06:53 AM
  5. "Space Used" in WHM "Accounts List" shows an incorrect information
    By John K in forum cPanel and WHM Discussions
    Replies: 5
    Last Post: 07-12-2004, 01:39 AM
Linkedin       Facebook       Twitter       RSS       Flickr       YouTube