My actual limit is 1024
:
$ ulimit -a
core file size (blocks, -c) 0
data seg size (kbytes, -d) unlimited
scheduling priority (-e) 0
file size (blocks, -f) unlimited
pending signals (-i) 95979
max locked memory (kbytes, -l) 64
max memory size (kbytes, -m) unlimited
open files (-n) 1024
pipe size (512 bytes, -p) 8
POSIX message queues (bytes, -q) 819200
real-time priority (-r) 0
stack size (kbytes, -s) 10240
cpu time (seconds, -t) unlimited
max user processes (-u) 1024
virtual memory (kbytes, -v) unlimited
file locks (-x) unlimited
I tried:
sysctl -w fs.file-max=100000
and appending to /etc/sysctl.conf
:
fs.file-max = 100000
without success, even after running sysctl -p
to reload the settings and/or rebooting, on both Ubuntu 16.04 and CentOS 6.
It always stays set to 1024
.
This question is an extension of that other question.
For Ubuntu 17.04. See this solution.
Prior to Ubuntu 17.04:
I don't know why the above settings don't work but it seems you can get the same result by using the /etc/security/limits.conf
file.
/etc/security/limits.conf
sudo bash -c "echo '* - nofile 10240' >> /etc/security/limits.conf"
*
means all users. You can replace it by a specific username.-
means both soft
and hard
for the type of limit to be enforced. Hard can only be modified by the superuser. Soft can be modified by a non-root user and cannot be superior to hard.nofile
is the Maximum number of open files parameter.10240
is the new limit.Logout and log back in. sudo sysctl -p
doesn't seem to be enough to reload.
You can check the new limit with:
ulimit -n
Tested on Ubuntu 16.04 and CentOS 6. Inspired by this answer.