How do you permanently set process limit per user (ulimit -u
) in Ubuntu?
2 Answers
Edit /etc/security/limits.conf
and configure nprocs
appropriately.
You may need to add pam_limits
to your pam configuration. The default configuration has pam_limits configured for many services. You may want to add pam_limits to /etc/pam.d/common-session
.
-
-
I'm not 100% sure the PAM changes are still required, but they used to be -- was trying to grok some related bug reports, but it'd be easier to test it, I think.– belacquaApr 11, 2011 at 18:30
-
2@jgbelacqua: They are there for all the common login methods (login, sum sudo, and *dm) methods as well as cron methods for 10.4 and 10.10.– BillThorApr 11, 2011 at 18:34
-
A better description of this solution here: askubuntu.com/a/162230/119284– e_x_pJan 6, 2013 at 19:16
Edit /etc/security/limits.conf
, making changes per the examples and for the limits you want.
You'll also need to add a line to the /etc/pam.d/common-session
file:
session required pam_limits.so
The change to PAM modules may be necessary elsewhere, but generally, common-session
is included related configurations, e.g.,
$ grep common-session /etc/pam.d/sshd :
sshd:@include common-session