减少Unix或Gnu/Linux上进程的特权 [英] Reducing privileges of a process on Unix or Gnu/Linux
本文介绍了减少Unix或Gnu/Linux上进程的特权的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在编写程序,并希望它以降低的特权运行.我知道以root身份可以执行此操作,但是作为普通用户呢?我可以将用户设置为nobody,而无需先将其设置为root吗?
I am writing a program, and want it to run with reduced privileges. I know as root I can do this, but what about as a normal user. Can I set the user to nobody, without first setting it to root?
推荐答案
否,没有root权限,您无法将进程的用户更改为 nobody
.
No, you cannot change the user of a process to nobody
without root permission.
相关的系统调用为 setuid(2), seteuid(2),
The relevant syscalls are setuid(2), seteuid(2), setresuid(2) ...
(也许有一种特定于Linux的方式来限制进程中的新文件操作,但我不记得详细信息了)
另请参见 SE-Linux ,凭据(7),功能(7)并阅读高级Linux编程 ...
See also SE-Linux, Setuid, credentials(7), capabilities(7) and read Advanced Linux Programming ...
这篇关于减少Unix或Gnu/Linux上进程的特权的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文