Could someone tell me how to set the default value of nice (as displayed by top) of a user? I have found that /etc/security/limits.conf is the place but if I put either:

username_of_a_guy  -  nice  19
username_of_a_guy  soft  nice  19
username_of_a_guy  hard  nice  19

It doesn't work (while it should, right?).

Note that I've rebooted since then.

Thank you very much in advance for any help. I'm using debian unstable (uptodate).


At my work, we have a local network: everyone has its own computer and everyone can create an account on someone else's machine if one likes. The rule of thumb is simply that if you work on someone else computer, please nice your processes (nice 19).

I would like to set the default nice value for a given user to 19 once and for all.


2 Answers 2


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.

  • 3
    First of all, thanks for your answer ( thank you as well, @mattdm ). It seems this method works. However, I'm still confused about the difference between "nice" and "priority" : both are displayed by "top" but the value quoted for nice is the one I have to set for priority. It looks a bit strange to me. Also, does a bigger priority (say 39 instead of 20) mean a less important process as it does for nice? Thank you.
    – Alex
    Commented Mar 10, 2011 at 14:10
  • 4
    The 'NI' nice priority in top is what would be set by the limits priority setting. This will be the default priority of any processes for that user/group when they log in. You can only set this to be between -20 and 20. The 'PR' value in top is the actual scheduler priority, which is determined by several factors by the kernel's scheduler.
    – jsbillings
    Commented Mar 10, 2011 at 14:26
  • 1
    Also, yes, a higher priority means that it is less likely to be scheduled to get CPU cycles.
    – jsbillings
    Commented Mar 10, 2011 at 14:32
  • 1
    Ok, thanks a lot for this disambiguation. BTW, I haven't tried the other methods (involving and or cgroup) which might be better in other situations than mine (need of a continuous check, or management of many users -which is a bit too much in my case).
    – Alex
    Commented Mar 10, 2011 at 16:05
  • Hmmmm... This worked for one user but not the other on my Ubuntu machine. I'll come back if I can work out why. ;-)
    – Ken Sharp
    Commented Dec 18, 2015 at 13:27

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).

  • I agree that using cgroups is an excellent way to limit other people from hogging all the CPU cycles on your computer. Sadly, the systems I support (RHEL5) don't have kernels that support it, so I have to stick with adjusting the priority. Once we update to RHEL6, I'm sure we'll have some fairly complex cgroups settings.
    – jsbillings
    Commented Mar 10, 2011 at 15:00

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .