Saturday, April 6, 2013

SSH config makes your life easier

How to simplify your day-to-day ssh usage with config file!

As you know there is a rule called '90/10'. 90 percent of users use only 10 percent of software capabilities. And it works not only for huge programs as MS Office but even for small utilities like ps, ls or ssh.
I used ssh for many years as some kind of barbarian who found microscope and uses it for chopping nuts!

Why am I writing all this? Because only one file can save a lot of keyboard clicks!
Ssh client looks for ~/.ssh/config file to apply configuration for new session. Simple example:

Host home
  Hostname 192.168.0.100
  User root
  Port 222

To ssh to your home you can only type ssh home instead of
ssh -p 222 root@192.168.0.100            

You can use Host as a mask for several hosts:

Host webfe* *.company.com db*.hosting.com
  User root
  IdentityFile ~/.ssh/key

And Host * can be set as a default settings for all sessions:

Host *
  Compression yes
  CompressionLevel 7
  Cipher blowfish

See man ssh_conf for more sugar!

No comments:

Post a Comment