Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can POSIX message queues be used cross user on Linux?

I have implemented a POSIX message queue. On the listener side, I am opening the queue like this:

mqdes = mq_open(s_mailbox_name.c_str(), O_RDONLY | O_CREAT, S_IRWXU | S_IRWXG | S_IRWXO, NULL);

On the sender side, I am opening the queue like this:

mqdes = mq_open(m_s_mailbox_name.c_str(), O_WRONLY);

The string is the same on both, lets call it /foobox

Now, when I run both the sender and receiver as the same user on the box, everything works perfectly. However If the sender and receiver are 2 different users, the receiver can not open the queue. I would think this wouldn't be a problem because I am opening the queue as 0777 above so everyone can RWX.

Is there something obvious i'm doing wrong? Or is this not possible (Please don't let it be this one)

Thanks

like image 897
Salgar Avatar asked Dec 09 '09 18:12

Salgar


1 Answers

Check umask.

From man mq_open: "The permissions settings are masked against the process umask."

like image 179
Tomek Szpakowicz Avatar answered Sep 30 '22 02:09

Tomek Szpakowicz