Skip to content

Instantly share code, notes, and snippets.

@chales
Last active July 9, 2025 21:41
Show Gist options
  • Select an option

  • Save chales/5448026 to your computer and use it in GitHub Desktop.

Select an option

Save chales/5448026 to your computer and use it in GitHub Desktop.
SSH Config - Sample file to show staff the common options to add to your '~/.ssh/config' file. This is just a text file and should have the same perms as the other files in ~/.ssh, usually 600 (read and write by user only).
#### Example SSH config file
######################################
#### Examples
# Example 1
Host example1
Hostname 192.168.1.1
# Non standard port
Port 2222
# Enable forwarding
ForwardAgent yes
# Proxy forwarding the connection
ProxyCommand ssh staging nc %h %p 2> /dev/null
# Example 2
Host example2
Hostname 192.168.1.2
# Enable forwarding
ForwardAgent yes
######################################
#### defaults / catchall
Host *
User twilliams
IdentityFile ~/.ssh/id_rsa
# Enable compression
Compression yes
# Hash known-host names
HashKnownHosts yes
# Keep connection alive
ServerAliveInterval 15
ServerAliveCountMax 3
# Allow local and proxy commands
PermitLocalCommand yes
# Multiplexing
ControlPath ~/.ssh/master-%r@%h:%p
ControlMaster auto
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment