4

Is there any way to allow user modify process niceness without giving root permisions?

OS: Ubuntu 14.04.1 LTS

user31027
  • 141
  • 2

2 Answers2

2

Since allowing sudo nice is pretty much the same as granting root permissions, I would not consider doing that.

I see two possible solutions:

1/ Allow the full command via sudo and pin it's parameters, like:

%nicegroup ALL=/bin/nice --20 /bin/whatever

But that works only if it is always the same program that needs nice'ing.

2/ Allow only renice via sudo like this:

%nicegroup ALL=/bin/renice

The users then need to start their program like always and afterwards manually renice it via sudo /bin/renice 20 -p $PID.
That is manual effort, but it can be scripted to be automated.

faker
  • 17,326
  • 2
  • 60
  • 69
1

No, there is not. nice is one of those commands that will run the process given in its own context - that is, if you allow sudo nice, any commands passed to nice will be executed as root. It may be possible to use /etc/limits.conf and use nice limits that way and run the script you want to be higher/lower priority, but it doesn't help with renice.

Nathan C
  • 14,901
  • 4
  • 42
  • 62