Is it possible to send a signal to process that belongs to different user?

寵の児 提交于 2020-01-02 07:07:38

问题


I need to send a signal to different process for some real-time communication, however the process belongs to different user.

For example

PID   user   group
1234  foo    foobar   
4321  bar    foobar

I want process 1234 and 4321 to be able to send signals to each other?

If I was using sockets or pipes I could set their mask to rw-rw-r-- and communication would work. However I need to do the communication using signals (ordinary or real time, not important).

Is there a way to do it?


回答1:


Quote from kill(2):

For a process to have permission to send a signal it must either be privileged
(under Linux: have the CAP_KILL capability), or the real or effective user ID
of the sending process must equal the real or saved set-user-ID of the target
process.  In the case of SIGCONT it suffices when the sending and receiving
processes belong to the same session.

You can find capabilities(7) and setcap(8) useful.



来源:https://stackoverflow.com/questions/13334902/is-it-possible-to-send-a-signal-to-process-that-belongs-to-different-user

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!