Take the 2-minute tour ×  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
3 Answers 3  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  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 ...