Skip to main content

Is it possible to impose a minimum niceness on a specific user? [Resolved]

Is it possible to limit a specific user's processes to always run with a niceness of at least 15, say?


Question Credit: kjo
Question Reference
Asked October 9, 2019
Tags: limit
Posted Under: Unix Linux
9 views
1 Answers

You can set per-user or per-group nice values using pam_limits and the /etc/security/limits.conf file.

e.g.

username    hard    priority    15

This only affects PAM services which are configured to use the pam_limits module. Depending on your distribution, this is probably already enabled for services like login, cron, atd, sshd, and others. Or you may have to enable it by adding a line like the following to, e.g., /etc/pam.d/login:

session    required   pam_limits.so

See man pam_limits and the comments in /etc/security/limits.conf for details. If you have the PAM doc package installed, there may be additional documentation at /usr/share/doc/libpam-doc/html/sag-pam_limits.html


credit: cas
Answered October 9, 2019
Your Answer