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.

Revisions

  1. chales revised this gist Nov 18, 2013. 1 changed file with 3 additions and 3 deletions.
    6 changes: 3 additions & 3 deletions ssh-config
    Original file line number Diff line number Diff line change
    @@ -2,13 +2,13 @@

    # 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
    # e.g. Host 192.168.1.1 example.com example1 myalias1
    # Hostname = the IP or real hostname
    # e.g. Hostname 192.168.1.1
    # 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
    # e.g. Port 2345

    # The above would allow you to use 'ssh exp1' or 'ssh myalias1' which are now
    # both equivalent commands for 'ssh jdoe@192.168.1.1 -p2345'
  2. chales revised this gist Nov 18, 2013. 1 changed file with 24 additions and 18 deletions.
    42 changes: 24 additions & 18 deletions ssh-config
    Original file line number Diff line number Diff line change
    @@ -1,20 +1,19 @@
    #### Example SSH config file

    # Host = a list of domains, IPs and aliases that use this config entry.
    # e.g. Host 192.168.1.1 exp1
    # 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
    # which is now equivalent to: ssh jdoe@192.168.1.1 -p2345
    # ssh jdoe
    # The above would allow you to use 'ssh exp1' or 'ssh myalias1' which are now
    # both equivalent commands for 'ssh jdoe@192.168.1.1 -p2345'


    #### Examples
    #### Example entries

    # Example 1
    Host 192.168.1.1 example1
    @@ -23,7 +22,7 @@ Host 192.168.1.1 example1
    Port 2222
    # Enable forwarding
    ForwardAgent yes
    # Proxy forwarding of the connection via 192.168.1.4
    # Proxy forwarding of the connection via 192.168.1.3
    ProxyCommand ssh jdoe@192.168.1.3 nc %h %p 2> /dev/null

    # Example 2
    @@ -33,27 +32,34 @@ Host 192.168.1.2 example2
    ForwardAgent yes

    ######################################
    #### defaults / catchall
    # 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
    # Enable compression.
    Compression yes

    # Hash known-host names
    # Hash known-host names for additional security.
    HashKnownHosts yes

    # Keep connection alive
    # Keep connection alive may benefit some connections.
    ServerAliveInterval 15
    ServerAliveCountMax 3

    # Forward agent
    # ForwardAgent yes

    # Allow local and proxy commands
    PermitLocalCommand yes

    # Multiplexing shared connections to improve speed
    ControlPath ~/.ssh/master-%l-%r@%h:%p
    ControlMaster auto
    # 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
  3. Chris Hales revised this gist Apr 25, 2013. 1 changed file with 26 additions and 10 deletions.
    36 changes: 26 additions & 10 deletions ssh-config
    Original file line number Diff line number Diff line change
    @@ -1,27 +1,41 @@
    #### Example SSH config file
    ######################################

    # Host = a list of domains, IPs and aliases that use this config entry.
    # e.g. Host 192.168.1.1 exp1
    # 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
    # which is now equivalent to: ssh jdoe@192.168.1.1 -p2345
    # ssh jdoe


    #### Examples

    # Example 1
    Host example1
    Host 192.168.1.1 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
    # Proxy forwarding of the connection via 192.168.1.4
    ProxyCommand ssh jdoe@192.168.1.3 nc %h %p 2> /dev/null

    # Example 2
    Host example2
    Host 192.168.1.2 example2
    Hostname 192.168.1.2
    # Enable forwarding
    ForwardAgent yes

    ######################################
    #### defaults / catchall
    Host *
    User twilliams
    User jdoe
    IdentityFile ~/.ssh/id_rsa

    # Enable compression
    @@ -34,10 +48,12 @@ Host *
    ServerAliveInterval 15
    ServerAliveCountMax 3

    # Forward agent
    # ForwardAgent yes

    # Allow local and proxy commands
    PermitLocalCommand yes

    # Multiplexing
    ControlPath ~/.ssh/master-%r@%h:%p
    ControlMaster auto

    # Multiplexing shared connections to improve speed
    ControlPath ~/.ssh/master-%l-%r@%h:%p
    ControlMaster auto
  4. Chris Hales renamed this gist Apr 23, 2013. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  5. Chris Hales created this gist Apr 23, 2013.
    43 changes: 43 additions & 0 deletions config
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,43 @@
    #### 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