How to avoid forkbomb?

Chuck Swiger cswiger at mac.com
Sat Mar 19 06:14:58 PST 2005


Ryan J. Cavicchioni wrote:
> Am I looking at the correct values?

Yes.

> Which is the actual process limit?

The lower number, 3632, is the max processes permitted per user.

> What would you recommend that I set it to in order to have my machine 
> shrug off the fork bomb sooner?

Probably around 300.

> What would be a good process limit for a LAMP webserver?

The # of Apache children you want to run + 50 or so...

> How would I set the process limits?

You could change login.conf (be sure to run "cap_mkdb /etc/login.conf"), or 
you could change the limits seen all processes by changing /etc/profile, or 
for specific user accounts by changing that user's startup scripts:

# Set reasonable soft process limits.
ulimit -Sc 100000
ulimit -Sd 512000
ulimit -Ss 65536
ulimit -Sn 512
ulimit -Su 256

-- 
-Chuck



More information about the freebsd-questions mailing list