Customize SSH config for every login


/ Published in: Bash
Save to your folder(s)

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


Copy this code and paste it in your HTML
  1. #Here is an example ~/.ssh/config file.
  2.  
  3. Host *panix.com
  4. User suominen
  5. Compression no
  6.  
  7. Host *gw.com
  8. FallBackToRsh no
  9.  
  10. Host foo
  11. Hostname bar.com
  12. User baz
  13.  
  14. Host *
  15. Compression yes
  16. CompressionLevel 9
  17. FallBackToRsh yes
  18. KeepAlive no
  19.  
  20. # Options are accumulated over entries,
  21. # but a more specific entry will override a less specific one.
  22. # E.g. in the above, compression will not be used for hosts
  23. # that match *panix.com but will be used for hosts that match
  24. # *gw.com (and all other hosts since the * entry matches all hosts).
  25. # And you can 'ssh foo' as an alias for 'ssh [email protected]'

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

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.