bash: fork: Resource temporarily unavailable

cPanel servers, particularly with jailshell enabled, may produce the error fork: Resource temporarily unavailable

To increase the resources available to a regular user you need to edit three files

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

Each will contain code similar to the following...

if [ "$LIMITUSER" != "root" ]; then
ulimit -n 100 -u 10 -m 100000 -d 100000 -s 8192 -c 100000 -v 100000 2>/dev/null
else
ulimit -n 4096 -u 14335 -m unlimited -d unlimited -s 8192 -c 1000000 -v unlimited 2>/dev/null
fi

In the first ulimit command, update it to a higher figure. eg. 35 as in the following

if [ "$LIMITUSER" != "root" ]; then
ulimit -n 100 -u 35 -m 100000 -d 100000 -s 8192 -c 100000 -v 100000 2>/dev/null
else
ulimit -n 4096 -u 14335 -m unlimited -d unlimited -s 8192 -c 1000000 -v unlimited 2>/dev/null
fi

Now log in as a regular user, not root, and the error should be gone. If it hasn't, as root you can check how many processes a user is using and adjust the limit accordingly.

ps aux | grep USERNAME | grep -v grep | wc -l

  • 0 Users Found This Useful
Was this answer helpful?

Related Articles

Changing host name in CentOS/CloudLinux

Login with ssh  (Use putty.exe on Windows or Terminal in MacOS and Desktop Linux) cd...