File descriptor

From Q
Jump to navigation Jump to search

Global limit


# cat /proc/sys/fs/file-max


File: /etc/sysctl.conf
fs.file-max = 65536

Apply the changes made in sysctl.conf.

# sysctl -p

Per-user limit


# ulimit -n


File: /etc/security/limits.conf
username         soft    nofile          4096
username         hard    nofile          16384

Instead of username you can also use * as a wildcard.

The soft limit is the value a user starts with after login and the hard limit is the value a user is allowed to raise the value to.

Changes can be made with

$ ulimit -n 8192
Note: For users this gets applied at login via When running a daemon it may have to set this by its own.