There is no magic disable fork bomb script, however the following values added into your
/etc/profile will normally go a long way to stopping problems. As always, you should limit
who actually has access to your server through ssh.
Place the following in your /etc/profile:
For a 512MB RAM system:
# No core files by default
ulimit -c 0 > /dev/null 2>&1
# 512MB virtual memory limit
ulimit -v 524288 > /dev/null 2>&1
# 256MB resident memory limit
ulimit -m 262144 > /dev/null 2>&1
# 128 max processes per user
ulimit -u 128 >/dev/null 2>&1
For a 1GB RAM system:
# No core files by default
ulimit -c 0 > /dev/null 2>&1
# 768MB virtual memory limit
ulimit -v 786432 > /dev/null 2>&1
# 384MB resident memory limit
ulimit -m 393216 > /dev/null 2>&1
# 128 max processes per user
ulimit -u 128 >/dev/null 2>&1
You should also take a look at your /etc/security/limits.conf file, and modify
it as needed. This will only affect applications/daemons that use PAM by default,
but it can also help in securing your server.
