The configuration file for ssh only set the default options for itself. When a user runs ssh, it first looks at the command line options, $HOME/.ssh/config followed by /etc/ssh/ssh_config. This allows a user to put in his own options.

The format of $HOME/.ssh/ssh_config is quite simple. There are quite a few options here but not all are required.

A simple host entry would be

host foo
compression yes
DSAAuthentication yes
hostname ssh.foo.com
user foo2
IdentityFile [filename]

Each section in the config file starts with a "host" line. Wildcards (* and ?) are allowed here. A "Host *" would mean that the configuration below is to be used for all hosts. "Host *freeos.com" is also a valid entry.

Compression is a good option to give here. In addition to an encrypted connection, you can also choose to compress the data. This is great over slower modem links. An additional parameter that you can give after this is "CompressionLevel". Possible values for this are 1 thru 9 with 1 being the least level of compression and 9 being the most compression.

DSAAuthentication specifies that you would like to use the more secure DSA method of authentication.

Hostname parameter should be set to the host that you are trying to connect to. This is only required if you are using the "Host" parameter as an alias to Hostname. Here I am using foo as an alias for ssh.foo.com. When I try to connect to foo, I will actually connect to ssh.foo.com.

User is the user you want to connect to the host as.

IdentityFile should point to your RSA or DSA key. This is useful when you have to specify different keys for different hosts. If not specified then
$HOME/.ssh/identity or $HOME/.ssh/id_dsa is read. For DSA keys you need to
use "IdentityFile2". Multiple identity files can be specified here; they will all be tried in sequence.

One thing you need to be careful of is to make sure that your defaults are placed after the host declarations. This is because every option in ssh is set only the first time. Let's say, we have defined a default parameter for user in the configuration file. It is set to foo2.
In a subsequent host section, we set the user to foo3. This will cause problems because ssh first reads the default value of foo2 but when it comes down to the host section it will ignore the user line because we have already specified it up ahead in the configuration file. So make sure
that all the default parameters that you use across all hosts come last in the file.

There are a lot more options here and the ssh man page is a great resource
for that. Or, you could always send me a mail.

OpenSSL.org
OpenSSH.com
Zlib

<< previous                        back to main menu

1