The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

How can we correct quota to include "nobody" files?

Discussion in 'General Discussion' started by dougiamas, Nov 15, 2003.

  1. dougiamas

    dougiamas Member

    Joined:
    Jul 15, 2003
    Messages:
    13
    Likes Received:
    0
    Trophy Points:
    1
    My sites upload a lot of files via the web, and these are naturally stored under Apache's "nobody" user.

    However, these files are of course not included in the quota calculations, which makes them effectively useless!

    Has anyone got a workaround to fix the Cpanel calculations?
     
  2. thedavid

    thedavid Well-Known Member

    Joined:
    Nov 22, 2002
    Messages:
    124
    Likes Received:
    0
    Trophy Points:
    16
    It's not cpanel - it's just the way the linux based quota system works. If this app is a php app that uploads these files, consider using phpsuexec - that way the 'user' writing the files will be the user running the php file.

    Do some research before jumping on that, as it can/will break some things when you move to it.

    -David
     
  3. dougiamas

    dougiamas Member

    Joined:
    Jul 15, 2003
    Messages:
    13
    Likes Received:
    0
    Trophy Points:
    1
    Thanks David - yes I was aware the linux quota is the source of the error, I guess I was hoping for a modification in cpanel so it didn't rely on raw quota numbers, but somehow added the size of 'nobody' files within their directory.

    But, phpsuexec sounds like a much better solution - thanks! I wasn't aware of it but I'll look into it now. :D

    Cheers!
     
  4. jsteel

    jsteel Well-Known Member

    Joined:
    Jul 4, 2002
    Messages:
    646
    Likes Received:
    0
    Trophy Points:
    16
    Location:
    Atlanta, GA
    You could always write a quick script that you run daily (or at some regualr interval) via cron to chown the files back to their owners.
     
  5. dougiamas

    dougiamas Member

    Joined:
    Jul 15, 2003
    Messages:
    13
    Likes Received:
    0
    Trophy Points:
    1
    Doh, headsmack! Thanks, J! :)

    I've got phpsuexec running on a new server and it's working well once I figured out a few ideosyncrasies it caused (for example, to get pathinfo to work properly from a CGI version of PHP you need to add cgi.fix_pathinfo = 1 into php.ini). Now it's running it's a good solution for the future.

    But automating chown is a great solution to avoid messing too much with my older stable servers. I've already implemented it with something like this:
    Code:
    #!/bin/tcsh
    
    cd /home
    foreach accountname (*)
      cd /home/$accountname
      if ( -e "mydata" )  then
          chown -R $accountname mydata
          chgrp -R nobody mydata
          chmod -R 770 mydata
      endif
    end
    
    
     
    #5 dougiamas, Nov 16, 2003
    Last edited: Nov 16, 2003
  6. Doctor

    Doctor Well-Known Member

    Joined:
    Apr 26, 2003
    Messages:
    180
    Likes Received:
    0
    Trophy Points:
    16
    Hi dougiamas !

    Can you tell me what else (other than pathinfo) did you configure to get phpsuexec to work on your server?

    Also, your automated chown script, is that the complete code? Should I change anything to make it work on my server? If I don't have tcsh configured, can I change the line #!/bin/tcsh to #!usr/bin/perl ? How can I make the script to work with all the accounts in my /home directory without changing the accountname one-by-one?

    Your help will be greatly appreciated because I can't get phpsuexec to work properly because of permission problems. Thanks in advance.
     
  7. thedavid

    thedavid Well-Known Member

    Joined:
    Nov 22, 2002
    Messages:
    124
    Likes Received:
    0
    Trophy Points:
    16
    See, I tried this as well - but it didn't work for me or for the scripts that I've tried it on. Is there anything else special that you did to get that working?

    -David
     
  8. dougiamas

    dougiamas Member

    Joined:
    Jul 15, 2003
    Messages:
    13
    Likes Received:
    0
    Trophy Points:
    1
    Most of my messing around was simply because I was trying to rebuild Apache manually... eventually I remembered the WHM option to rebuild Apache and configure PHP (which I'd avoided in the past) ... I tried it (note that this has the phpsuexec option in there) and it worked fine.

    Then there was the pathinfo fix, which allows URLs like http://example.com/file.php/par1/par2/par3

    The line I mentioned above goes in /usr/local/lib/php.ini (I restarted Apache just to be sure with apachectl restart)

    I also made sure all the scripts were chmod 755 or chmod 700. This document has some useful information about this: http://www.modscentral.com/exoops/modules/mydownloads/visit.php?lid=306

    With this all my scripts are working,
     
  9. dougiamas

    dougiamas Member

    Joined:
    Jul 15, 2003
    Messages:
    13
    Likes Received:
    0
    Trophy Points:
    1
    Yes, that's the complete code .. note that my server is probably unique in that all the data folders have the same name for each user (ie mydata in my script). No you can't change the first line to perl - it's a tcsh script, but yes, it already works with all users in the home directory.

    You could chmod ALL the files in each /home directory with something like:
    Code:
    #!/bin/tcsh
    
    cd /home
    foreach accountname (*)
       chown -R $accountname $accountname
       chmod -R o-wx $accountname
    end
    
    YMMV, no liability, no guarantee, no support etc

    You should be VERY careful changing permissions for ALL of the files in everyone's directory - I don't know but it could possibly break other things .... also note there are some non-user directories in /home.
     
  10. Doctor

    Doctor Well-Known Member

    Joined:
    Apr 26, 2003
    Messages:
    180
    Likes Received:
    0
    Trophy Points:
    16
    Thanks for the tip, dougiamas!

    FINALLY, I got everything working in order with phpsuexec enabled. It is a tough job getting phpsuexec to work, especially having so many accounts using different PHP scripts but I believe it is worth it! :D
     
  11. jsteel

    jsteel Well-Known Member

    Joined:
    Jul 4, 2002
    Messages:
    646
    Likes Received:
    0
    Trophy Points:
    16
    Location:
    Atlanta, GA
    Wouldn't recommend doing the whole home directory as you'll hose up things like email, anonftp, etc.
     
Loading...

Share This Page