Ubuntu – Unable to change ulimit setting

linuxUbuntuulimit

I edited /etc/security/limits.conf to have

root hard nofile 20000
root soft nofile 10000

And added

session required pam_limits.so

to /etc/pam.d/common-session and /etc/pam.d/common-session-noninteractive.

After reboot and relogin ulimit -n still shows 1024.

If I do su and try ulimit -n again then it shows 10000. But after a relogin it goes back to 1024.

Best Answer

Check the manual: man limits.conf

That will show you that the first field in that configuration file is the <domain> or simplified: the users or groups for whom the setting is applied to. So when you use root there it's completely expected that it only works for root and not for any other user.

Try the following to apply it to all users or better find some middle ground and apply to the correct users/groups.

*     hard      nofile     20000
Related Question