Skip to content

Instantly share code, notes, and snippets.

@ryancdotorg
Created February 20, 2014 15:19
Show Gist options
  • Save ryancdotorg/9116041 to your computer and use it in GitHub Desktop.
Save ryancdotorg/9116041 to your computer and use it in GitHub Desktop.
# This allows SSH to share a session - opening a second SSH connection to the same user@host:port will open a new shell channel in that session.
ControlMaster auto
ControlPersist 60
ControlPath ~/.ssh/master/%h|%p|%r
# use a different username for this one
Host htpc.local
User r
# a simple alias
Host console.prgmr.com
IdentitiesOnly yes
HostName wemyss.prgmr.com
# ssh into initramfs to supply full disk encryption passphrase
Host decrypt.foo
User root
PasswordAuthentication no
ChallengeResponseAuthentication no
UserKnownHostsFile ~/.ssh/known_hosts.initramfs
ControlMaster no
RequestTTY no
HostName 192.168.1.13
# <hostname>.tor connects to hostname via tor and suppresses my pubkeys
Host *.tor
IdentitiesOnly yes
IdentityFile ~/.ssh/id_rsa_tor
PubkeyAuthentication no
ProxyCommand sh -c 'exec socat STDIO SOCKS4A:localhost:`basename %h .tor`:%p,socksport=9050'
# allow ssh to tor hidden services with a different pubkey
Host *.onion
IdentitiesOnly yes
IdentityFile ~/.ssh/id_rsa_tor
ProxyCommand socat STDIO SOCKS4A:localhost:%h:%p,socksport=9050
# Don't bother tracking hostkeys for ec2 instances
Host *.amazonaws.com
UserKnownHostsFile /dev/null
StrictHostKeyChecking no
PasswordAuthentication no
# Use a different key for ec2 us-west
Host *.us-west-1.compute.amazonaws.com
IdentityFile ~/.ssh/id_amazon_west.pem
# This is so I can make keys for <username>.github.com and use that is the remote host in git
Host *.github.com
IdentitiesOnly yes
HostKeyAlias github.com
ProxyCommand socat STDIO TCP:github.com:%p
# This should be the last entry - for ssh-chain, see github.com/ryancdotorg/ssh-chain
Host *^*
ControlPersist 10
ProxyCommand ~/code/ssh-chain/ssh-chain %h %p
# IdentityFile magic, should be placed at very end of file.
# Allows easier management of many ssh keys without having
# to repeatedly fiddle with ~/.ssh/config. If it's not clear
# you set up your keys as id_rsa_username@host.example.com
# substituting ANY for either the username or hostname if
# desired.
Host *
IdentityFile ~/.ssh/keys/id_ecdsa_%r@%h
IdentityFile ~/.ssh/keys/id_rsa_%r@%h
IdentityFile ~/.ssh/keys/id_dsa_%r@%h
IdentityFile ~/.ssh/keys/id_ecdsa_ANY@%h
IdentityFile ~/.ssh/keys/id_rsa_ANY@%h
IdentityFile ~/.ssh/keys/id_dsa_ANY@%h
IdentityFile ~/.ssh/keys/id_ecdsa_%r@ANY
IdentityFile ~/.ssh/keys/id_rsa_%r@ANY
IdentityFile ~/.ssh/keys/id_dsa_%r@ANY
IdentityFile ~/.ssh/keys/id_ecdsa_ANY@ANY
IdentityFile ~/.ssh/keys/id_rsa_ANY@ANY
IdentityFile ~/.ssh/keys/id_dsa_ANY@ANY
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment