0

Tmux server and my tmux sessions are being killed at the end of my SSH sessions.

SSH session:

# timepoint 0

$ tmux
# timepoint 1

# ^D
[detached (from session 0)]
# timepoint 2

$ tmux a
# timepoint 3
# ^D
[detached (from session 0)]
# timepoint 4

$ exit
# timepoint 5

Output of ps command as seen from a second SSH session:

# timepoint 0
$ sudo ps aux | grep -v grep | grep tmux

# timepoint 1
$ sudo ps aux | grep -v grep | grep tmux
khouli   29401  0.0  0.0  19492  2884 pts/6    S+   02:31   0:00 tmux
khouli   29403  0.0  0.0  21792  3112 ?        Ss   02:31   0:00 tmux

# timepoint 2
$ sudo ps aux | grep -v grep | grep tmux
khouli   29403  0.0  0.0  21792  3112 ?        Ss   02:31   0:00 tmux

# timepoint 3
$ sudo ps aux | grep -v grep | grep tmux
khouli   29403  0.0  0.0  21792  3112 ?        Ss   02:31   0:00 tmux
khouli   29752  0.0  0.0  19492  1140 pts/6    S+   02:31   0:00 tmux a

# timepoint 4
$ sudo ps aux | grep -v grep | grep tmux
khouli   29403  0.0  0.0  21792  3112 ?        Ss   02:31   0:00 tmux

# timepoint 5
$ sudo ps aux | grep -v grep | grep tmux

At timepoint 0, there are no tmux processes. At timepoint 1, a tmux client and server are running as expected. After detaching from the server at timepoint 2 there is only the server running. Re-attaching works as expected and at timepoint 3 there is both a server and client running. At timepoint 5 we see that when the SSH session closed it took down the tmux server with it which defeats the whole point of using tmux.

What's going on or how can I debug this?

tmux is version 2.0. The shell is bash.

This is without a .tmux.conf file. I have a .bash_logout but it only contains comments.

1 Answer 1

0

This was being caused by using AllowUsers in my sshd config file. Either not using this option or including root in AllowUsers fixes this -- tmux sessions started over ssh persist after the ssh session is closed.

Having PermitRootLogin no in my sshd config appears to prevent an actual remote root login even with root in AllowUsers.

The whole thing feels very quirky since without root in AllowUsers I can still ssh in and then su to become root.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .