Le multiplexage évite d’ouvrir une nouvelle connexion pour chaque commande.
objectifs d’apprentissage
- Activer ControlMaster.
- Configurer ControlPath.
- Tester le gain de temps.
prérequis
- ~/.ssh/config modifiable.
- Client OpenSSH récent.
notions clés
- ControlMaster auto.
- ControlPersist 10m.
- ControlPath sockets.
démonstration guidée
étape 1
Configurer le multiplexage pour myserver.
cat >> ~/.ssh/config << 'EOF'
Host myserver
HostName 203.0.113.10
User ubuntu
ControlMaster auto
ControlPersist 10m
ControlPath ~/.ssh/cm-%r@%h:%p.sock
EOF
étape 2
Mesurer l’exécution de deux commandes successives.
time ssh myserver 'true'
time ssh myserver 'true'
exercice
Ajoutez StreamLocalBindUnlink yes pour éviter des sockets orphelines et testez.
correction
Option utile selon OS.
ssh -o StreamLocalBindUnlink=yes myserver 'true'
quiz éclair
- Quelle option conserve la connexion en arrière-plan ?
- a) ControlPersist
- b) ControlMaster=off
- c) ProxyJump