Remix.run Logo
jnpnj 6 days ago

I just found out about https://stackoverflow.com/a/52838493

    Host myhost
      Hostname host
      User user
      RequestTTY yes 
      RemoteCommand tmux new -A -s foobar
homebrewer 6 days ago | parent | next [-]

This breaks rsync & many other things that rely on SSH as transport. Try:

  alias ssh="ssh -o RequestTTY=force -o RemoteCommand='tmux new -A -s foobar'"
burnt-resistor 5 days ago | parent | next [-]

I use an ssh virtual host pattern *-tmux to copy over an ssh-specific tmux.conf to a remote host before connect and then connect to it with -f tmux-ssh.conf. I can also connect to a host directly without tmux stuff by omitting the -tmux suffix.

idatum 6 days ago | parent | prev [-]

Or just use a different myhost, like "t-myhost" (i.e. myhost != hostname)?

homebrewer 6 days ago | parent [-]

Which would require creating a couple of hundred (in my case) duplicate host aliases instead of adding one shell alias that can be used with any host, including those not mentioned in ~/.ssh/config.

godelski 6 days ago | parent | next [-]

You can resolve this with a conditional. See the `Match` keyword.

Though I agree, probably not the best solution to start all sessions with tmux. There's other issues it can cause.

burnt-resistor 5 days ago | parent | prev [-]

No, host matches allow wildcards.

burnt-resistor 5 days ago | parent | prev [-]

Please don't do this. Do something like instead except don't call it .tmux.conf, use .tmux-ssh.conf and -f: https://stackoverflow.com/a/66709528