This post applies to RHEL 6 and RHEL 7. I changed the nproc limit for a user to 16383 in /etc/security/limits.conf.
cat >> /etc/security/limits.conf username soft nproc 16383
When I checked it with ulimits -n, it isn’t working.
su - username ulimits -a 1024
This is because, to prevent a fork bomb, the default limits for all users except root is set to 1024 in RHEL 6. The setting is in /etc/security/limits.d/90-nproc.conf which overrides /etc/security/limits.conf.
cat /etc/security/limits.d/90-nproc.conf # Default limit for number of user's processes to prevent # accidental fork bombs. # See rhbz #432903 for reasoning. * soft nproc 1024 root soft nproc unlimited
cat /etc/security/limits.d/20-nproc.conf # Default limit for number of user's processes to prevent # accidental fork bombs. # See rhbz #432903 for reasoning. * soft nproc 4096 root soft nproc unlimited
The solution is to create a file in /etc/security/limits.d/ that will override the limit for the user.
cat <<EOF > /etc/security/limits.d/99-username-limits.conf # username user limits file username soft nproc 16383 EOF