Skip to content

Instantly share code, notes, and snippets.

@kcsinclair
Created September 21, 2023 01:31
Show Gist options
  • Save kcsinclair/797b8eec7631c1c5828583232bf375d0 to your computer and use it in GitHub Desktop.
Save kcsinclair/797b8eec7631c1c5828583232bf375d0 to your computer and use it in GitHub Desktop.
Useful SSH feature configuration for ~/.ssh/config
# file is typically /home/username/.ssh/config or ~/.ssh/config
# Enable SSH connection multiplexing.
ControlMaster auto
ControlPath /tmp/ssh_mux_%h_%p_%r
# default settings for all hosts
Host *
AddKeysToAgent yes
UseKeychain yes
# typical host configuration when DNS is available (one config for many hosts)
Host name1 name2 name3 name4
Hostname %h.domain.com
ForwardAgent yes
Compression yes
ServerAliveInterval 60
user userid
# typical host configuration when no DNS
Host staticip
Hostname 1.2.3.4
ForwardAgent yes
Compression yes
ServerAliveInterval 60
user userid
# older Linux OS's
Host old-centos
Hostname 1.2.3.4
ForwardAgent yes
Compression yes
ServerAliveInterval 60
PubkeyAcceptedAlgorithms +ssh-rsa
HostkeyAlgorithms +ssh-rsa
user userid
# for Cisco IOS
Host ciscorouter
Hostname 5.4.3.2
ForwardAgent yes
Compression yes
ServerAliveInterval 60
KexAlgorithms +diffie-hellman-group1-sha1
Ciphers +aes256-cbc
PubkeyAcceptedAlgorithms +ssh-rsa
HostkeyAlgorithms +ssh-rsa
user userid
# bitbucket entry
Host bitbucket
HostName bitbucket.org
user git
# Use the SSH private key which matches the public key configured in bitbucket
identityfile ~/.ssh/id_rsa_you_use_for_git
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment