On Ubuntu 22.04, editing limits.conf to increase number of file descriptors doesn't work

I followed this answer: https://askubuntu.com/a/162230

I edit limits.conf, now it is

* soft nofile 65536
* hard nofile 65536
* soft nproc  65536
* hard nproc  Unlimited
root soft nofile 65536
root hard nofile 65536

Also, I edit both "/etc/pam.d/common-session" and "/etc/pam.d/common-session-noninteractive". Add the line at the end of both files:

session required pam_limits.so

And I restarted the Ubuntu, but "prlimit" still shows

NOFILE  ... 1024  65536 files

ulimit -n also shows 1024

How could I change this permanently?

Asked By: Ryan

||

The easiest way to change this is to put ulimit -S -n 65536 in your shell init file (.bashrc possibly).

Answered By: user10489