1

A school assignment requires demonstrating the use of the cap_kill capability. To my understanding, this capability is supposed to allow a given program to send any signal to any process and be successful.

I've used the following line:

setcap cap_kill+ep /bin/kill

So, the kill command should be able to send SIGKILL for example to any process. However, after adding this capability, I'm still only able to kill my own processes, so I'm unable to see any effect of adding the capability. I think I should even be able to kill -9 1 with this capability yet I receive bash: kill: (1) - Operation not permitted

How am I supposed to demonstrate this capability? Thank you.

tomix86
  • 1,336
  • 2
  • 18
  • 29
Sethypie
  • 549
  • 6
  • 21

1 Answers1

4

Init(PID 1) cannot be killed in user-level mode. There are different runlevels in Linux to prevent unexpected interruption in the session.

lamino
  • 132
  • 1
  • 9
  • I've experienced exactly the same problem. In Ubuntu 20.04 and in Fedora 32, it doesn't matter. Something is wrong with it – Osqui Oct 21 '20 at 10:10
  • Sorry, I can't edit my self comment. I've discovered that if I copy the kill binary and apply the capability on the copy, it works. (!!?) – Osqui Oct 21 '20 at 10:38