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.

Ulimits

Discussion in 'General Discussion' started by kenashkov, Feb 14, 2011.

  1. kenashkov

    kenashkov Active Member

    Joined:
    Nov 23, 2006
    Messages:
    33
    Likes Received:
    0
    Trophy Points:
    6
    Location:
    Sofia, Bulgaria
    cPanel Access Level:
    Root Administrator
    Hi,

    I'm trying to lift all possible memory limits imposed to the user accounts as php wont run at all from command line (not even phpinfo()). I've added to /etc/security/limits.conf
    Code:
    *               hard     core            0
    *               hard     data            0
    *               hard     rss             0
    
    I've commented out the CPanel Limit Protection from both /etc/profile.d/limits.sh and from /etc/profile... But still the users have
    Code:
    core file size          (blocks, -c) 200000
    data seg size           (kbytes, -d) 200000
    
    How can I remove these limitations as right now php in cli mode can not be run at all?

    Thank you
     
    #1 kenashkov, Feb 14, 2011
    Last edited: Feb 14, 2011
  2. cPanelTristan

    cPanelTristan Quality Assurance Analyst
    Staff Member

    Joined:
    Oct 2, 2010
    Messages:
    7,623
    Likes Received:
    21
    Trophy Points:
    38
    Location:
    somewhere over the rainbow
    cPanel Access Level:
    Root Administrator
    Hello kenashkov,

    Do you have WHM > Shell Fork Bomb Protection enabled that adds these lines to /etc/profile file?

    Code:
    ulimit -n 4096 -u 14335 -m unlimited -d unlimited -s 8192 -c 1000000 -v unlimited 2>/dev/null
    
    LIMITUSER=$USER
    if [ -e "/usr/bin/whoami" ]; then
            LIMITUSER=`/usr/bin/whoami`
    fi
    if [ "$LIMITUSER" != "root" ]; then
            ulimit -n 100 -u 20 -m 200000 -d 200000 -s 8192 -c 200000 -v 200000 2>/dev/null
    else
            ulimit -n 4096 -u 14335 -m unlimited -d unlimited -s 8192 -c 1000000 -v unlimited 2>/dev/null
    fi
    If so, try disabling it and then see if you are able to get the php cli to run. Also, can you please provide the exact command you are trying in root SSH as an example along with the error message you are receiving?

    Thanks!
     
  3. kenashkov

    kenashkov Active Member

    Joined:
    Nov 23, 2006
    Messages:
    33
    Likes Received:
    0
    Trophy Points:
    6
    Location:
    Sofia, Bulgaria
    cPanel Access Level:
    Root Administrator
    Hi,

    I manually commented out these lines in /etc/profile (as well in /etc/profile.d/limits.sh).
    The exact command from the shell is as simple as just trying to run php:
    Code:
    # php
    Out of memory
    
    (the error comes from ulimits not from memory_limit from php)
    Now I disabled the shell fork bomb protection from WHM web interface and it works. So it seems the difference between enabled/disabled is not only in these lines, because by just commenting these out or changing them to a much higher values does not have any effect. I changed also the limits in /etc/profile.d/limits.sh, but didnt help.
    Is there something else that needs to be edited if the fork bomb protection is left enabled?
     
  4. cPanelTristan

    cPanelTristan Quality Assurance Analyst
    Staff Member

    Joined:
    Oct 2, 2010
    Messages:
    7,623
    Likes Received:
    21
    Trophy Points:
    38
    Location:
    somewhere over the rainbow
    cPanel Access Level:
    Root Administrator
    If you remove all the components that cause shell fork bomb protection to function, I'm not certain if there would be a point to having it enabled. The areas that I'm aware of it being in would be the one I mentioned, but I believe simply disabling it would make the most sense given you would like to disable all the ulimits it is enacting as that's the entire point of shell fork bomb protection in the first place :)
     
  5. kenashkov

    kenashkov Active Member

    Joined:
    Nov 23, 2006
    Messages:
    33
    Likes Received:
    0
    Trophy Points:
    6
    Location:
    Sofia, Bulgaria
    cPanel Access Level:
    Root Administrator
    Yes, of course :)
    I was just curious is there any other thing/script modified by this protection as when I disables these manually (by commenting these lines) it didn't work. Anyway, the fork bomb protection is off now and seems fine.
    Thank you!
     
  6. DomineauX

    DomineauX Well-Known Member
    PartnerNOC

    Joined:
    Apr 12, 2003
    Messages:
    414
    Likes Received:
    4
    Trophy Points:
    18
    Location:
    Houston, TX
    cPanel Access Level:
    Root Administrator
    I have experienced the same before when attempting to raise the ulimit values to permit php to execute properly without removing limits entirely. Shell fork bomb protection seems to be affecting something else other than what is mentioned.
     

Share This Page