[SATLUG] Fork bomb prevention

Bruce Dubbs bruce.dubbs at gmail.com
Mon Oct 11 10:12:27 CDT 2010


Christopher Lemire wrote:
> I'd like to get an idea of how many processes my user and the root user are
> running, so I can know what to set ulimit to in /etc/security/limits.conf
> 
> $ ~  ps -ef | grep --count
> Usage: grep [OPTION]... PATTERN [FILE]...
> Try `grep --help' for more information.
> $  ~

You could try 'ps -ef|grep root|wc -l' or 'ps -ef |grep -c ^.*$'

> I'm missing pattern with this, so I try * (match all), as a pattern,
> And that is not giving me the output I hoped for either. Any ideas?
> What do you guys set ulimit to? I imagine it has to be done every boot.
> Or it has to be done every time a terminal is opened if not set in that
> config file.

I generally leave ulimit at the defaults.  There have been a couple of 
times when I needed a change, but not many.  One instance was when 
running the gcc regression tests, I needed to increase the stack size.

Note that ulimit has two contexts.  One is a bash internal function and 
one an OS function.  The OS function only limits file sizes and is 
deprecated.

   -- Bruce



More information about the SATLUG mailing list