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.

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.

/etc/pam.d/common-session
/etc/pam.d/cron
/etc/pam.d/login
/etc/pam.d/sshd
/etc/pam.d/su
/etc/pam.d/sudo

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

What am I missing?

share|improve this question
add comment

3 Answers

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.

share|improve this answer
add comment

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
4096

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

share|improve this answer
add comment

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)

E.g.

 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

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.