Is there a way to prevent Gnome System Monitor from providing kill option in the context menu for a given process ?
If you can't help but asking why I want this, I was assigned the (perplexing) task of trying to prevent the execution of kill [specific process] for root/users with elevated privileges throughout the system. Apart from this sounding illogical, I have been reading posts that describe that this is not only not possible but detrimental.
So I decided to approach this by collecting evidences to corroborate the inviability of this, by breaking it into:
- prevent execution of kill from command line
- prevent killing of process from GUI
- prevent stopping systemd
- in my app (a .NET app which runs as a systemd daemon), intercept the kernel signal sent to the process upon running kill (perhaps calling sigaction) so to ignore the kill request.
This question tries to clear item number 2: does System Monitor offer the possibility of hiding/customizing commands from its context menu, such as kill, out-of-the-box ?

org.gnome.gnome-system-monitor.killPolkit action - what you should do is disallow that action for your target users using Polkit.