Tmux + SSH

Problem Statement

I like ssh (I have servers I do not physically sit at, and I pay for their usages, so I'd rather not uselessly invoke a rdp/vnc server). I like tmux, because terminal multiplexing is right and proper. I pretty much always do tmux attach -t admin || tmux new -t admin upon logging in. Automation is good, generally.

V and the Terrible, Horrible, No Good, Very Bad Solution

You /can/ do the following in your .bashrc. You shouldn't, for a varienty of reasons, but you can...

tmux attach -t admin || tmux new -t admin

What? You don't ever use scp? or git? or pelican's make ssh_upload? I like all three, so this is a dirty nasty hack for me.

SO's good solution

StackOverflow not Significant Other (though as a hobbyist dev/sysadmin, may as well be the same) had the correct answer. Use 'new' ssh and tmux! Inside "$HOME"/.ssh/config:

Host <host>+tmux
  Hostname <host>.<tld>
  User <user>
  RequestTTY yes
  RemoteCommand tmux new -A -s admin

Tells ssh to execute tmux new with the '-A' flag, with tells it to attempt to attach to the admin session, then create it if the session doesn't exist.

Why write this post?

I predict this site will disappear before SO, but my memory is fickle and bad, and this site is kinda like a notebook of important info for me.