Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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
add comment

3 Answers

up vote 2 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
add comment

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
add comment

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
add comment

Your Answer

 
discard

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.