TIL: Recreating tmux socket

    I use tmux as a multiplexer and for running some long-running commands on servers. Today I encountered a weird issue: when trying to attach to an existing tmux session (or when trying to do anything with tmux), I would get the following error:

    can't create socket: Permission denied

    A quick search on Kagi revealed that it might be permissions issue. I tried resetting the permission of the /tmp/tmux-* folders, but it didn't help.

    What did work however was recreating the socket the tmux server uses to communicate with the tmux client. To do that, you have to run the following command:

    killall -s SIGUSR1 tmux

    And then the tmux attach worked perfectly, showing me all the windows from my old session.

    I have no idea though why this happened.