zolrath / wemux

Multi-User Tmux Made Easy
MIT License
3.63k stars 139 forks source link

error connecting to /tmp/wemux-wemux (Permission denied) #61

Open ipatch opened 7 years ago

ipatch commented 7 years ago

Not sure if this is a wemux issue or an OS X issue, but for whatever reason I can only start wemux when the user is the owner of the socket. Putting both users in the same group and changing the group permissions of the socket does not seem to help either.

jamesb commented 7 years ago

Not sure of the scenario experienced by @ipatch, but it sounds similar to an issue we're having.

In a configuration where multiple users can host wemux, suppose user foo starts a wemux session and then ends the tmux session without using wemux stop (say, by closing all tmux windows). In this scenario, the wemux socket will be left as something like... srw-rw-rw- 1 foo foo 0 Sep 6 10:55 wemux-wemux= ... and another user, baz, won't be able to successfully run wemux start because the server isn't running and foo owns the socket. If baz has sudo access, baz can sudo chown baz /tmp/wemux/wemux and then remove it.

The wemux script currently responds to both wemux stop and wemux kill by calling the stop_server function. We can differentiate wemux kill by attempting to forcibly change the ownership of the socket (using sudo, as above) before calling stop_server. This is convenient in a multi-tenant compute instance and should help ease some frustration when colleagues forget to cleanly stop the wemux session.

I'm creating a PR.