HostOnNet Blog

User Resource limits on Cpanel Server

Looking for Linux Server Admin or WordPress Expert? We can help.

Today i tried to run java on a dedicated server as normal user. This is required as part of sidekick installation.

But i got following error

Error occurred during initialization of VM
Could not reserve enough space for object heap

This is caused by limits set to normal users on Cpanel server. As root java works well.

Problem is fixed by editing files

/etc/profile
/etc/bashrc
/etc/profile.d/limits.sh

and removing following entry

#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 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
#cPanel Added Limit Protections — END

These are added by cpanel to limit user resource when you enabled Shell Fork Bomb Protection in WHM.

Posted in Cpanel Server, Linux. Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.