You cannot send signals to processes of other users, in general. It does not matter if the program runs as root or under another user. Therefore, do not count on them. You need some other way to interact with that program.
If you want to do with less blood, you can make a wrapper for running under sudo from your user. The wrapper is needed to limit the user's ability to complete any other programs, as well as to run programs with root privileges harder than one line.
The file /usr/local/bin/kill-root-service , provided that your program is called exampled :
#!/bin/sh killall exampled # или ищем ID процесса и посылаем сигнал ему
Then:
sudo chmod +x /usr/local/bin/kill-root-service sudo visudo
Add a line:
%users ALL = NOPASSWD: /usr/local/bin/kill-root-service
With this line, all members of the users group will have the right to run kill-root-service without entering a password like this:
sudo kill-root-service
Thus, launching this command will do everything you want.
They will not have the right to execute any other commands. Just as there will be no right to change that file, unless, of course, you yourself explicitly allow it.
This method is also the most reliable. With other seemingly simple options, including creating some kind of common file, as suggested in the comments, a lot can go wrong. For example, ended inodes on disks and the file was not created. You need to not only create and track files, but also take into account all sorts of erroneous situations, which complicates the whole scheme. It may even be easier to arrange communication between processes by regular means (pipes, TCP, and so on).
kill()) to the program as root only if it is started by root - Mikekill()system call, so it doesn’t matter what the program will send your own signal or kill, the rights work the same way - Mike