简体   繁体   English

赋予非root用户进程功能以更改其美观程度

[英]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. 我有一个基于Linux的进程(用C ++编写,如果有区别的话),该进程是由非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. 我想这样做而不实际运行这两个以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. 我尝试弄乱limits.conf,但到目前为止没有成功。

Thanks 谢谢

In short, that's impossible. 简而言之,这是不可能的。

Only the super-user may lower priorities. 只有超级用户可以降低优先级。

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

It would be abused if non-privileged user could increase their processes's priority. 如果非特权用户可以增加其进程的优先级,则会被滥用。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM