2

Adding

ControlMaster auto
ControlPath ~/.ssh/sockets/%C
ControlPersist yes

to ~/.ssh/config automatically creates a control connection that stays alive for a long time. This works at home where Internet is stable but not when mobile, changing IPs etc. autossh, on the other hand, restarts ssh when it goes away. An ideal combination would be

  1. An ssh connection is initiated
  2. If there is no control socket, it starts autossh which starts another ssh to the same host establishing the control socket.
  3. It now uses as the socket as a slave.

Manually starting autossh to everywhere I might git push to is just not feasible.

I read Using autossh to create a persistent, multiplexed ssh connection without any port forwarding? and I understand ControlPersist will need to go, that's OK, the workflow above makes it absolutely unnecessary.

6
  • No, I want git to be faster. It's much faster over existing connections because it doesn't need to re-auth.
    – chx
    Jul 31, 2018 at 8:30
  • ??? VPN doesn't need to reauth, and it includes the capability to reconnect when connection lost, or when getting new ip (and the tcp socket also won't lost, while you lost the existing connection while reconnecting ssh). You wanna a stable vpn connection to your server, but instead of vpn you're trying some hackish solution via ssh. Try openvpn! Jul 31, 2018 at 8:32
  • When you do git push or git pull over SSH it authenticates for every single one of those. That's a waste. And it's not my server, I am using about a dozen different remote repositories and that's just git, there's another dozen or more client servers. It's so much nicer over exisitng connection. Try ControlMaster! :P
    – chx
    Jul 31, 2018 at 8:52
  • Yes, the same what i said. Don't use ssh as a primitive vpn, just use vpn as a vpn. Jul 31, 2018 at 8:54
  • This makes no sense. How would a VPN speed up git push to github, as an example?
    – chx
    Jul 31, 2018 at 8:54

0

You must log in to answer this question.

Browse other questions tagged .