2

I want to allow users to set a nicelevel lower than 0 (and any nice level really) in my system. I'm testing by logging in again as a user of the affected user group after I set the change and trying:

nice -n -18 sleep 1

Which keeps producing the message:

nice: cannot set niceness: Permission denied

I also check ulimit -a which doesn't change after saving my changes in limits.conf.

I have tried reading some google results. And came up with this in my /etc/security/limits.conf:

@mygroup   soft    nice    -20
@mygroup   hard    nice    18

I also tried the reverse, since nice is reversed (so hard -20 and soft 18), which didn't work.

As some google results suggested I made sure the line:

session    required   pam_limits.so

Is not commented in my /etc/pam.d/login file (it wasn't when I first checked).

Any suggestions how to enable this?

I am using Ubuntu 12.04 precise.

1 Answer 1

4

I ended up firing up a server I could mess around with more and I tried more combinations. I couldn't get hard or soft to play nice (get it?), so I tried - and it worked. I also confirmed with Ubuntu 14.04 trusty.

I figured - sets hard and soft limits:

 @mygroup   -    nice    -20

This does work once you log on and off. You won't see any entry regarding nice in ulimit -a. What you should be looking for is:

scheduling priority             (-e) 40

Which nice later on probably treats as [-20 19]. The default value for this entry is 0.

Using dash seems to enable any priority. So if anyone can get hard and soft to work drop a comment or an answer. Thanks.

You must log in to answer this question.

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