Return to Snippet

Revision: 6081
at April 29, 2008 03:39 by cczona


Updated Code
#Here is an example ~/.ssh/config file.

  Host *panix.com
    User suominen
    Compression no

  Host *gw.com
    FallBackToRsh no

  Host foo
    Hostname bar.com
    User baz

  Host *
    Compression yes
    CompressionLevel 9
    FallBackToRsh yes
    KeepAlive no

# Options are accumulated over entries, 
# but a more specific entry will override a less specific one.
# E.g. in the above, compression will not be used for hosts 
# that match *panix.com but will be used for hosts that match
# *gw.com (and all other hosts since the * entry matches all hosts).
# And you can 'ssh foo' as an alias for 'ssh [email protected]'

Revision: 6080
at April 25, 2008 14:02 by cczona


Initial Code
#Here is an example ~/.ssh/config file.

  Host *panix.com
    User suominen
    Compression no

  Host *gw.com
    FallBackToRsh no

  Host *
    Compression yes
    CompressionLevel 9
    FallBackToRsh yes
    KeepAlive no

# Options are accumulated over entries, 
# but a more specific entry will override a less specific one.
# E.g. in the above, compression will not be used for hosts 
# that match *panix.com but will be used for hosts that match
# *gw.com (and all other hosts since the * entry matches all hosts).

Initial URL
http://kimmo.suominen.com/docs/ssh/#config

Initial Description
Changing default settings

The defaults for the ssh-related commands can be altered for each account in a configuration file ~/.ssh/config (there is also a system-wide file, usually /etc/ssh/ssh_config). Each entry starts with a Host keyword. You can use wildcards to match all the appropriate systems:

    * ? matches any single character
    * * matches any sequence of zero or more characters

Usual keywords include (defaults in parenthesis):

Compression yes/no (no)
    Controls whether compression is used on the connection. 
CompressionLevel 1-9 (6)
    Level of compression: 1 is fastest, 9 is slowest (achieves best compression). Compression is good for slow links (saves bandwidth) and fast machines. 
FallBackToRsh yes/no (yes)
    If a secure connection to the remote system cannot be established the commands can try unsecure connections (a warning will be displayed if this happens). On highly secure systems this could be disabled in the system-wide configuration. 
KeepAlive yes/no (yes)
    Controls whether TCP keepalive messages are used. When enabled it is possible to detect network outages and automatically close your connections (which is good). However, if you are connected over a dialup link that automatically dials when there is traffic, you will want to turn this off to avoid unnecessarily bringing up the line. 
User account (local account)
    Specify the remote account name. Add this to avoid having to use the -l option when issuing commands. 


For a complete list of options see sshd_config(5): http://netbsd.gw.com/cgi-bin/man-cgi?sshd_config+5

NOTE: Host can alternately set an alias name for a Hostname

Initial Title
Customize SSH config for every login

Initial Tags
ssh

Initial Language
Bash