Reputation: 11
I would like to stop process (proc2) which was started by root by my unprivileged process (proc1).
My process proc1 calls execl("/bin/sh","sh","-c","/etc/init.d/proc2 restart",nullptr).
and /etc/init.d/proc2 restart calls start-stop-daemon
which fails because of lack of capabilities to kill proc2 (suid root)
What kind of capabilities have to be set to unprivileged process proc1 in order it could run start-stop-daemon (kill proc2)?
Upvotes: 1
Views: 2948
Reputation: 149085
I will rewrite your question as how is it possible to trigger an administrative task (requiring root priviledges) from a user lever process?
The common way if to set a priviledged relay that will accept to be activated from a non priviledged task. There are two classical ways to do that in Unix/Linux world:
sudo
is just an example of such a root seutid executable but it has been extensively testedIn either way, you must considere the security question: how to ensure only legitimate triggering of the priviledged task.
Upvotes: 1