Quick 'n Nerdy

SSH Performance Voodoo

Just a quick note on SSH’s performance when working with multiple connections to the same server. You can tell SSH to re-use a connection to a server for all subsequent connections (up to a defineable limit) which greatly speeds up connection time as you simple hop onto the existing connection without doing the initial handshake, auth, etc each time. You can define this either in your local ssh-config (~/.ssh/config) or system-wide in /etc/ssh/ssh_config.

Host *
ControlMaster auto
ControlPath ~/.ssh/sockets/%r@%h-%p
ControlPersist 600

Basically, for each unique destination, SSH (or ssh-agent) will create a unique socket under ~/.ssh/config that will be reused everytime you connect to the same host again. Fast as fuck.

Leave a Reply