0

I am having a scenario where I wanted to increase the open file limit for a specific user. So I tried adding the limit in the/etc/security/limits.conf file. Can you please help me understand how the open file limit is set? Because in my case in the limits.conf file I have set

username hard nproc 65536

username hard nofile 65536

but when I switch to the specified user and check the ulimits for hard, it is picking up the default value.

bash-4.2$ ulimit -Hn

4096

bash-4.2$ ulimit -Sn

1024

But when I add a root entry to the limits.conf file, for all the users the max open files limits changed to 65536.

username hard nproc 65536

username hard nofile 65536

username soft nofile 65536

root soft nofile 65536

root hard nofile 65536

root soft nproc 65536

root hard nproc 65536

serv-we1-dss-dev soft nproc 65536

[root@we ~]# ulimit -Sn

65536

[root@we ~]# su username

bash-4.2$ ulimit -Hn

65536

After adding the root entries I still faced an issue where the open file limits for the process id's were still 4096

[root@we ~]# prlimit -n --pid=14560

RESOURCE DESCRIPTION SOFT HARD UNITS

NOFILE max number of open files 4096 4096

So I tried adding a * entry to the limits.conf file.

  •   soft    nofile  65536
    
  •   hard    nofile  65536
    

After adding those entries all the process id's were having 65536 as open files limits.

[root@we ~]# prlimit -n --pid=15999

RESOURCE DESCRIPTION SOFT HARD UNITS

NOFILE max number of open files 65536 65536

Can anyone please help me understand this scenario, where initially just the username entries were mentioned in the limits.conf file and when checking the ulimits it as giving the default values. Then tried adding root entries and when checked for the users, the limits changed to 65536 but the open file limit for the PID remains 4096. Then again I tried adding * entry to the file and after that the PID limits changed to 65536.

Please help me understand how these limits are being picked up by the system.

pranauv
  • 1
  • 1

0 Answers0