How to set ulimit value permanently?

Solution 1:

Option one: You did not set the softlimit higher aswell.

Possible solution:

in /etc/security/limits.conf add

* soft nofile 2048

test with

ulimit -n 2048 

Option two: You are logged in as user and in some "config" file (profile, bashrc, something like this) the soft limit is set to a lower value.

Possible solution f.e. grep for ulimit in your etc folder and/or home folder.

Warning: Depending on the amount of files/directorys you have in there you might want to consider only specific directorys/files

ps: there are a lot of similiar question here you might want to read up.

Specially Hard vs Soft Limit

Read here for possible other solution which go more into detail Too Many Open Files

Solution 2:

There is a bug in Debian. To increase ulimit you need to add this into the /etc/pam.d/common-session file:

session required pam_limits.so

and in /etc/security/limits.conf add:

*               soft    nofile          65535
*               hard    nofile          65535

Then reboot the system.