7
➜ sudo sysctl -a|grep file

fs.file-max = 2037581
fs.file-nr = 2784   0   2037581

➜ ~ cat /proc/sys/fs/file-max
2037581

➜ ~ cat /proc/sys/fs/file-nr
2720    0   2037581

/etc/security/limits.conf

* hard nofile 2037581
* soft nofile 2037581
root hard nofile 2037581
root soft nofile 2037581

/etc/pam.d/su

session required pam_limits.so

/etc/pam.d/common-session

session required pam_limits.so

then reboot.

but ulimit -n got 1024 again.

only can ulimit -n 4096 as max value

or got error

 ulimit: value exceeds hard limit
1
  • Did you try setting a minimally changed limit instead? Jul 9, 2016 at 22:32

2 Answers 2

0

If u set root hard nofile 65535 it will only change root users limit. If you want to change another users limit add that users username for example,

sharewind hard nofile 65535 Or add * for username which will change all users limit. But it is not recommended.

3
  • 1
    It doesn't work
    – sharewind
    May 8, 2014 at 1:54
  • Did you change both soft and hard file limits. If not add the soft file limit too. I used hard limit only as an example May 11, 2014 at 9:17
  • I have the same experience as @ManulaWaidyanatha
    – Jeune
    Jan 27, 2015 at 7:47
0

I found that if the service is launched under an upstart init script you must use the stanza limit to control this!

See: http://bryanmarty.com/2012/02/10/setting-nofile-limit-upstart/

You must log in to answer this question.

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