linux limits.conf not working?
Asked Answered
R

2

14

I configured /etc/security/limits.conf like this.

user1               soft    core            0
user1               hard    core            0

Then, I rebooted the system and logged in as root then I did this.

su user1
ulimit -c unlimited

then I executed a buggy application to generate core file. since I set the core limit to zero from limits.conf, I expected the core will not be generated but, that was not the result, the core was normally generated. what's wrong??

some advice would be appreciated.

Ravel answered 12/6, 2014 at 8:46 Comment(0)
R
33

limits.conf is read by pam_limits.so, so you need to check that this module is enabled in /etc/pam.d/su. On my system, this was commented out by default:

# Sets up user limits, please uncomment and read /etc/security/limits.conf
# to enable this functionality.
# (Replaces the use of /etc/limits in old login)
# session    required   pam_limits.so

Once uncommented, the module will start working immediately. If you still have problems, check your auth log (maybe /var/log/auth.log), which is where limits-related errors will be written.

Risa answered 12/6, 2014 at 9:6 Comment(0)
C
0

Try doing this as well

# echo DefaultLimitNOFILE=65535 >> /etc/systemd/system.conf
# echo DefaultLimitNOFILE=65535 >> /etc/systemd/user.conf
Censorious answered 5/2, 2021 at 12:44 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.