How to change max open files limit in Linux

By default, each user is limited maximum number of open files to 1024. Sometimes this value might be insufficient, e.g., you are running peer-to-peer applications on the host. If you want to see the current value, run ulimit -n or ulimit -a to see all limits. Anyway, you should get error messages as follow whenever the limit is not enough.

Too many open files

All limits are specified in /etc/security/limits.conf. In order to change maximum number of open files for each users, add below line in that file.

*               hard    nofile          4096

* means all users will have hard limits of max open files as 4096.

Tags: ,

Post new comment