Centos 6 soft openfiles 1024

centos

Here are the conf files and details, no matter what I did, soft openfiles wont go over 1024.

CENTOS 6.7 x86_64

cat /etc/security/limits.conf
* soft nproc 65535
* hard nproc 65535
* soft nofile 65535
* hard nofile 65535

cat /etc/security/limits.d/90-nproc.conf
* soft nproc 65535
* hard nproc 65535
* soft nofile 65535
* hard nofile 65535

root@server [~]# ulimit -n
65535

cat /etc/sysctl.conf
fs.file-max = 65535

cat /proc/1/limits
Max open files 1024 4096

it shows the correct limit when you run ulimit -n but when you check cat /proc/1/limits it shows 1024, all programs on the server stucked with 1024 openfiles limit, they are all running under the root user.

Best Answer

The limits you are changing affect only logged in users as they're implemented by PAM as part of the logging in process. They have no effect on processes started other ways, such as by systemd or init directly.

If you want to change the limit of processes that are started by something other than a user logging in, you need to do it in that process itself. Processes that have root permissions can change their limits however they want.

# cat /proc/self/limits  | grep -i open
Max open files            1024                 1024                 files     

# ulimit -Hn 8192
# ulimit -n 8192
# cat /proc/self/limits  | grep -i open
Max open files            8192                 8192                 files     

# ulimit -Hn 65536
# ulimit -n 65536
# cat /proc/self/limits  | grep -i open
Max open files            65536                65536                files