Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Normally /etc/security/limits.h only work when you login into a shell.

How about when you fork a process in Linux, where is the value of Max open files of /proc/PID/limits is controlled by?

share|improve this question
up vote 3 down vote accepted

My understanding is that such settings in the child fork get inherited from the parent. Also, you can set the limit information in your process by using the getrlimit(), setrlimit() system calls.

share|improve this answer

The file /etc/security/limits.conf is used by pam_limits.

The command ulimit is a shell builtin command that can modify the soft and hard limits within the limits set by the PAM configuration file mentionned (unless you are root).

You can apply those limits on "login" or "ssh", etc. sessions. PAM then applies the limits on the processes (and forked processes) launched within this session. They are inherited.

share|improve this answer

Fork will inherit the environment from the parent who forked it ... if that has a limit on fd it should be applied.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.