I am on an Ubuntu18.04.1 bionic VM in the Azure cloud. I am trying to set the maximum number of file descriptors at the system level. When I initially logged in and ran ulimit -n I get a value of 1024. So I checked the /etc/security/limits.conf, but there was no configuration in it. So I thought maybe its configured that way in cat /proc/sys/fs/file-max, so when I checked that out it was set to 1426416. So question 1: Where is 1024 coming from?

I was able to change it by setting some entries in /etc/security/limits.conf for nofile for * and root domains and I bumped it to 65536 and now ulimit -n reflects it. So my question no 2: What is purpose of the entry in /proc/sys/fs/file-max? Which I think can be set using sysctl.conf

2 Answers 2


The file /etc/security/limits.conf is used to configure pam_limits and only affects users and services that start through the PAM stack.

/proc/sys/fs/file-max is defined by the kernel sysctl and is the setting for processes started by the OS.

You can also set the file limit in a systemd service by adding LimitNOFILE=1024 to the unit file.


Where is 1024 coming from?

This is the kernel’s default limit for the number of open files, per process. This is one of the resource limits which can be set for each process.

What is purpose of the entry in /proc/sys/fs/file-max?

file-max specifies the maximum number of file handles, for the whole system. Once this limit is reached, no process will be able to open a file, regardless of its own per-process limit.

nr_open, in the same directory, specifies the maximum per-process limit. The actual value used is the resource limit (see above); this determines what the maximum resource limit can be.

  • Very clear thank you!
    – hexbit1
    Commented May 17, 2020 at 20:51

You must log in to answer this question.

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