2005-03-27

Easy SSH Config

I don't know why I never bothered to do this before, but I finally put an SSH config file on my laptop.

Making an SSH config file is very easy, and you can get away with copying the basic format of the system-wide config file seen in /etc/ssh/ssh_config.

The config file is useful for per-host setup situations where you have a certain way of connecting to one machine and a different way of connecting to another. If you have a computer named "atlantic" and a computer named "pacific", you can have a separate entry for each of them and save yourself the hassle of ever having to make a complicated command line to connect to them again.

Make a file called "~/.ssh/config". Put the following lines in it as per your needs:

Host atlantic.host
  IdentityFile ~/.ssh/id_dsa.atlantic
  Protocol 2
  Port 22
  Cipher 3des

Host pacific.host
  Protocol 2,1
  Port 2022
  Cipher blowfish-cbc

More options exist of course, but just these few lines will save you from constantly typing "ssh -2 user@host" this and "ssh -2" that. If you create an SSH keypair devoid of a password, you can even save yourself the trouble of having to enter a password. Doing so is never recommended, but I confess I've done it from time to time on various hosts.

Edit: More options can be found in the ssh_config man page.

No comments: