Getting rid of ulimit restrictions.

Khanduras

Member
Jan 10, 2007
5
0
151
I know that it isn't the safest thing in the world to do, but for what I'm wanting to accomplish, I'm going to need to completely remove the ulimit restrictions set forth by cPanela and WHM upon new user creation.

Obviously, my /etc/limits.conf file is free of any restrictions, but cPanel users through jailshell apparently have limits set forth, as the gaming servers they are set up with are getting limited by resource consumption.

Now, I really need someone to tell me how to completely remove the ulimit restrictions created by WHM/cPanel upon account creation, so that I may continue to provide my users with their unrestricted game hosting accounts.

If someone could please tell me how to do this, in a hurry, I'd greatly appreciate it. Thanks muchly in advance.
 

erick_paper

Well-Known Member
Apr 19, 2005
245
0
166
I have turned off Shell Fork Bomb protection, but the ulimit has not been removed. I need this not for gaming etc, but for postgresql, which only gets "max user processes" of "20"!! I need like 14,335 for postgres to work at any decent pace!

I notice the ulimits are being setup in /etc/profile/.bash_profile. I changed them by commenting out the IF-ELSE condition at the top that checks for the root user. I basically now have ulimit for all users. But now my machine won't start. Any thoughts on this?
 

erick_paper

Well-Known Member
Apr 19, 2005
245
0
166
Sorry to bump this, but any thoughts would be lovely. This is the new stuff (highlighted in red). Now how can I make sure this is reflected in the ulimit for users other than root? Can I do it without rebooting the machine?

#********************* cPanel Added Limit Protections -- BEGIN
#unlimit so we can run the whoami
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 1024 -u 512 -m 200000 -d 2000000 -s 8192 -c 800000 -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
#********************* cPanel Added Limit Protections -- END
 

erick_paper

Well-Known Member
Apr 19, 2005
245
0
166
Hi. First, disable "Shell Fork Bomb" stuff from the "Security Center" in WHM. Second, just open the file /etc/profile and comment out the line at the very top in the IF condition that checks for root user or not. Here is what I have done for my stuff:

Code:
[B]#********************* cPanel Added Limit Protections -- BEGIN[/B]
[COLOR="Green"]#unlimit so we can run the whoami
#ulimit -n 4096 -u 14335 -m unlimited -d unlimited -s 8192 -c 1000000 -v unlimited 2>/dev/null
[/COLOR]ulimit -n 15096 -u 64335 -m unlimited -d unlimited -s 32192 -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 15096 -u 64335 -m unlimited -d unlimited -s 32192 -c 1000000 -v unlimited 2>/dev/null
else
        ulimit -n 15096 -u 64335 -m unlimited -d unlimited -s 32192 -c 1000000 -v unlimited 2>/dev/null
[COLOR="Green"]####        ulimit -n 4096 -u 14335 -m unlimited -d unlimited -s 8192 -c 1000000 -v unlimited 2>/dev/null
[/COLOR]fi
[B]#********************* cPanel Added Limit Protections -- END[/B]
Hope this helps! You may need to reboot the server for this to take effect, but I am not an expert.