Set Permanently ulimit -n / open files in ubuntu

I want to set that new configuration (65535) permanently in my server. You can do it with following steps below :

# available limit

ulimit -n

# To increase the available limit to say 65535

sudo nano /etc/sysctl.conf

# add the following line to it
fs.file-max = 65535

# run this to refresh with new config

sudo sysctl -p

# edit the following file

sudo nano /etc/security/limits.conf

# add following lines to it

* soft nproc 65535
* hard nproc 65535
* soft nofile 65535
* hard nofile 65535
root soft nproc 65535
root hard nproc 65535
root soft nofile 65535
root hard nofile 65535

# edit the following file

sudo nano /etc/pam.d/common-session

# add this line to it

session required

# logout and login and try the following command

ulimit -n

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.