My Digital Ocean droplet's ulimit -n
yields 1024
. Now it's a dedicated machine with Ubuntu 16.04, 32GB Ram, 16 Cores. I want to crank it up to 65535
.
The problem:
I followed a bunch of steps to configure this (given at the end). However, I run into a permission issue. Specifically:
Nginx
error.log
in/var/log/nginx/
shows:setrlimit(RLIMIT_NOFILE, 65535) failed (1: Operation not permitted)
auth.log
in/var/log/
shows:main-app sudo: pam_limits(sudo:session): Could not set limit for 'nofile' to soft=65535, hard=65535: Operation not permitted; uid=0,euid=0
I am scratching my head as to how to solve this. Can an expert show me the way?
Background:
There are several guides available across the internet for increasing ulimit -n
(and many answers on stackexchange, but none that appear to resolve this permissions issue). The steps I followed were:
i) Added fs.file-max = 65535
in /etc/sysctl.conf
.
ii) Ran sudo sysctl -p
thereafter.
iii) Added the following lines in /etc/security/limits.conf
:
* 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
iv) Added session required pam_limits.so
to /etc/pam.d/common-session
.
Logged out and back in. Tried rebooting and powering down and up too. ulimit -n
won't budge from 1024
.