Quantcast
Channel: User Kamil Maciorowski - Super User
Viewing all articles
Browse latest Browse all 837

Answer by Kamil Maciorowski for How can I have a remote SSH-like session that doesn't close due to connection failure?

$
0
0

Screen and tmux seem to require the user to manually detach and reattach sessions

Only if you don't know how to automate things.

I use tmux after ssh-ing (not before, compare this question). When my SSH connection breaks, I don't have to detach because I'm no longer connected anyway. When I connect again, test -n "$TMUX" || tmux a || tmux at the end of my .bashrc (on the SSH server side) reattaches me automatically.

If my login shell on the SSH server side was not Bash then I would need to use some other file, specific to my actual shell. The point is: starting a tmux client can be automated.

The topic is covered here: How can I set my default shell to start up tmux? There are answers that exec to tmux, there is at least one answer that runs tmux as a child of the shell (like my example above; I like to be able to detach from tmux and stay logged in).

(And there are answers where one sets up tmux as the login shell, but I don't think you can easily and sanely attach to an existing tmux session automatically in this case.)


Viewing all articles
Browse latest Browse all 837

Trending Articles