linuxunixcapabilitythread-prioritynice

Giving a non-root user process capabilities to change its niceness


I have a Linux based process (written in C++, if it makes any difference), that I run from a user which is not root.

In some point I have to run a new sub-process that should be able to change it's niceness level to a lower number (without changing niceness of the original process).

I would like to do that without actually running any of these two processed as root.

Could anyone please help me figure out how can I do that? I have tried messing with the limits.conf but I wasn't successful so far.

Thanks


Solution

  • In short, that's impossible.

    Only the super-user may lower priorities.

    from the manual of nice(2) and getpriority(2)

    It would be abused if non-privileged user could increase their processes's priority.