2012-11-11 25 views
3

我需要發送一個信號到不同的進程進行一些實時通信,但是這個進程屬於不同的用戶。是否可以向屬於不同用戶的進程發送信號?

例如

PID user group 
1234 foo foobar 
4321 bar foobar 

我要處理1234和4321能夠將信號發送到對方?

如果我使用套接字或管道,我可以將其掩碼設置爲rw-rw-r--並且通信可以工作。但是,我需要使用信號進行通信(普通或實時,不重要)。

有沒有辦法做到這一點?從殺

回答

5

報價(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. 

你可以找到能力(7)和setcap(8)是有用的。

+1

'CAP_KILL'能力覆蓋_任何權限檢查,我還想限制發送到特定用戶/組的信號?有沒有辦法做到這一點? – Artyom

+1

@Artyom唯一的其他出路似乎是在同一個uid下運行這兩個應用程序 –

相關問題