tags:

views:

44

answers:

2

I'm running a client/server application on Red Hat Enterprise using ZMQ for message passing. The IPC socket used to associate a client with the server is implemented using a Unix domain socket.

If user A starts the server process, it seems like only clients started by user A can connect to and communicate over that socket. Our project requires that the clients be able to be run by different users, so this is a major sticking point.

The socket is located at /tmp/ipc_assoc with default 755 permissions. chmod 777 does not fix the problem. chown userB allows user B to access the socket, but user A then loses access. Not even root can access the socket. There is no ACL or SeLinux in use on the machine.

Is this typical behavior for Unix domain sockets? Has anyone figured out how to work around it?

A: 

Have you tried adding UserA and UserB into a common user group?

Adrian Regan
Everyone seems to be in the same group already.
Dana Leonard
Is is a symbolic link to another file with different permissions?
Adrian Regan
No, if you run `ls -l` on the socket, it prints out "srwxr-xr-x ... ipc_assoc"
Dana Leonard
Well, this seems to show that the socket is only r/w/x for the owner, not the group. When you create the file in the server process, it will use the umask for the process 755, programatically change either the mask, or chmod the file to 770.
Adrian Regan
A: 

With some assistance from the ZMQ mailing list, I have made a work around. It's ugly, but seems to work consistently.

I had to make a subdirectory under /tmp and chmod 777 it. The server now creates the socket in that new folder. It also programmatically chmod 777 the socket. Now, as long as the server is run as root, any user can run a client and talk to the server.

I don't know why UNIX domain socket behave this way, but it sure is annoying.

Dana Leonard