SSH multiplexing (ControlMaster) ssh
Reuse existing connection for subsequent SSH commands
ssh -o ControlMaster=auto -o ControlPath=~/.ssh/mux-%r@%h:%p -o ControlPersist=10m user@host
more ssh
all 15 commands →
Run remote command
ssh user@host 'sudo systemctl status nginx'
Copy file via SCP
scp -r -P 2222 ./dist/ user@host:/var/www/app/
Agent forwarding
ssh -A user@bastion
Add key to agent
eval $(ssh-agent) && ssh-add ~/.ssh/id_ed25519
SSH config file host entry
cat >> ~/.ssh/config <<'EOF'
Host dev
HostName 10.0.0.5
User ubuntu
IdentityFile ~/.ssh/dev_key
ProxyJump bastion
EOF