How to restrict the number of processes a user can start?

We tried /etc/security/limits.conf, but that seems to have no effect.

The used line for limits.conf looks as follows:

myuser hard nproc 6

That is configuration for a server. I want to limit the processes started. Ulimit limits the processes started from the shell (if I understand that right). But in my case apache starts mapserver-processes, and that number have to be limited.


This is not the ideal solution because it can interfere with apache upgrades, but it should work.

Edit /etc/init.d/apache2, on the top of the script (new line after the #!/bin/sh) add the required ulimit, example:

ulimit -u 1024