Reuse SSH connections with ControlMaster
ssh connection multiplexing | ssh controlmaster controlpersist | speed up repeated ssh connections | ssh | controlmaster | performancessh -o ControlMaster=auto -o ControlPath=~/.ssh/cm-%C -o ControlPersist=10m webuser@server.example.comThe first connection creates a control socket that all further connections to the same target go through. Additional sessions, scp and rsync therefore start without a new handshake and without a second 2FA prompt. After logging out, ControlPersist keeps the connection open for another ten minutes.
Note: For permanent use, the three options belong in a Host block in ~/.ssh/config. ssh -O exit benutzer@host closes the master connection.
Also searched as
- ssh connection multiplexing
- ssh controlmaster controlpersist
- speed up repeated ssh connections