Set default nice value for a given user (limits.conf)

I believe the correct format is:

@users      -       priority        10
username    -       priority        19

This is an example of the settings I am using in production (obviously with real users/groups).

The nice setting is to determine the minimum nice value (i.e. maximum priority) someone can set their process to, not their default priority.


I can confirm that that doesn't work on my system either. The docs say "kernel 2.6.11 and up", and I'm on Fedora rawhide with kernel 2.6.38-rc6. I wonder if it is scheduler-dependent, and doesn't work with the introduced-in-2.6.23 CFQ ("Completely Fair Scheduler").

Something that will work, though, is the impossible-to-search-for-because-of-its-horrible-name and — the auto-nice daemon. See http://and.sourceforge.net/. This is available from Fedora with yum install and, but unfortunately doesn't seem to be in EPEL. And it's in Debian too: apt-get install and.

If you are using a modern distribution, though, there's an Even Better Way. You can use the tools from libcgroup to set up a kernel-level cgroup limiting CPU shares, and to automatically "classify" that user's processes into this cgroup. With this, you can also prioritize I/O, and limit memory usage (including share of the disk cache).

Tags:

Login

Limit

Nice