Skip to content

Instantly share code, notes, and snippets.

@leogopal
Created February 12, 2020 20:41
Show Gist options
  • Save leogopal/e32ffbac7f7fdbb6ad1f492f1fbd2591 to your computer and use it in GitHub Desktop.
Save leogopal/e32ffbac7f7fdbb6ad1f492f1fbd2591 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
# Host = a list of domains, IPs and personalized aliases that use this config
# entry. These alias names follow "Host" and are space delimited.
# e.g. Host 192.168.1.1 example.com example1 myalias1
# Hostname = the IP or real hostname
# e.g. Hostname 192.168.1.1
# User = the username
# e.g. User jdoe
# Port = if this is a non standard port, i.e. not 22
# e.g. Port 2345
# The above would allow you to use 'ssh exp1' or 'ssh myalias1' which are now
# both equivalent commands for 'ssh [email protected] -p2345'
#### Example entries
# Example 1
Host 192.168.1.1 example1
Hostname 192.168.1.1
# Non standard port
Port 2222
# Enable forwarding
ForwardAgent yes
# Proxy forwarding of the connection via 192.168.1.3
ProxyCommand ssh [email protected] nc %h %p 2> /dev/null
# Example 2
Host 192.168.1.2 example2
Hostname 192.168.1.2
# Enable forwarding
ForwardAgent yes
######################################
# Defaults / catchall options. Add this block to the end of your config file to
# enable these options for all unspecified connections.
Host *
# Default user
User jdoe
# Default identity, usually id_rsa which will be a sys default anyway.
IdentityFile ~/.ssh/id_rsa
# Enable compression.
Compression yes
# Hash known-host names for additional security.
HashKnownHosts yes
# Keep connection alive may benefit some connections.
ServerAliveInterval 15
ServerAliveCountMax 3
# Allow local and proxy commands
PermitLocalCommand yes
# Forward agent for pushing your ssh-agent. You will need to add your ssh key
# to the authorized_keys file on the remote system.
# Normally not a great idea to make this a global always on option unless you
# are sure the remote systems are secure.
#ForwardAgent yes
# Multiplexing shared connections to improve speed.
#ControlPath ~/.ssh/master-%l-%r@%h:%p
#ControlMaster auto
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment