cPanel: su: cannot set user id: Resource temporarily unavailable
I'm not exactly sure how it happened, but when I attempted to "su -" to root this morning, my system spat back the error:su: cannot set user id: Resource temporarily unavailableI don't recall changing anything, other than temporarily allowing root SSH access, restarting sshd and changing it back. The culprit seems to be cPanel and its "Shell Fork Bomb Protection". Logging into WHM -> Security -> Shell Fork Bomb Protection and clicking "Disable Protection" has resolved the issue.
*UPDATE* If, however, you would like the security provided by the "Shell Fork Bomb Protection", there is a workaround available as described in the cPanel forums by the user Abhilash V Nair. According to the post, the following edits to the following files are required to make this work (allowing specific users to "su -" while keeping the Fork Bomb Protection enabled). The files:
/etc/profile
/etc/bashrc
/etc/profile.d/limits.sh
In each of the files, find the section that starts, "#cPanel Added Limit Protections -- BEGIN". Within this section, change the appropriate lines to be similar to the following, where "foo" is your specific user:
if [ "$LIMITUSER" = "root" ]; then
ulimit -n 4096 -u 14335 -m unlimited -d unlimited -s 8192 -c 1000000 -v unlimited 2>/dev/null
elif [ "$LIMITUSER" = "foo" ]; then
ulimit -n 4096 -u 14335 -m unlimited -d unlimited -s 8192 -c 1000000 -v unlimited 2>/dev/null
else
ulimit -n 100 -u 20 -m 200000 -d 200000 -s 8192 -c 200000 -v 200000 2>/dev/null
fi



