I have the following lines in /etc/security/limits.conf

*           soft        nofile          32768
*           hard        nofile          65536
root        soft        nofile          32768
root        hard        nofile          65536

The pam_limits.so file is required in each of the following files.


ulimit -n upon login (and for services that are started upon bootup) shows 1024 still.

What am I missing?


5 Answers 5


For services in init.d you cannot use /etc/security/limits.d inittab is not reading that files and it is based on pam.d which is not used in initialization startup scripts. All init startup scripts source /etc/init.d/functions so for all services you could hack that script and set limits there. I used to hack /etc/sysconfig for particular services when I needed {httpd, some brokenass oracle stuf} e.t.c. Hope this helps.


Ubuntu 14.04

Had to add both 'hard' and 'soft' entries in /etc/security/limits.conf for pam to recognize settings for rtprio (-r) and memlock (-l).

  • This solved my issue in RHEL 7.1. Thanks! Aug 3, 2017 at 15:52

have you checked you don't have other config files in /etc/security/limits.d/?

Have you tried increasing it with ulimit?

$ ulimit -n 4096
$ ulimit -n

And after saving you must log in again. It's not enough to start a shell, it must be a login shell.


Try checking /var/log/auth.log

I've found answer to my problem there. In my case the limit was not set due to an error causing the default value (1024) to be used.


If you are root, execute the command below

 ulimit -SHn 65535

If you want to set it permanently, especially for a particular user, change the file /etc/security/limits.conf to have the following lines (assume user = www-data)


 www-data hard nofile 65535

 www-data soft nofile 65535

And make sure uncomment pam_limits.so from the different files under /etc/pam.d, e.g. sudo, login, sshd, ... after following above steps which you have already did.

Finally restart your system

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .