I use SSH every day. I love it. Not just for being very secure, but because it's simple and easy to use. There are a lot of tricks and tips out there about SSH: tunneling, port forwarding, SOCKS4/5 proxy, network speed tests, etc... but we don't have a lot of information about the configuration file ~/.ssh/config. Let's talk about it a little bit.

In this file we can specify simple options such as:

Now, every time we open a new connection, we will have this two options activated.

But we have a more interesting options. Imagine that we have a host where we normally access, called foo.example.com. We always make login as jim using a private RSA key stored in .ssh/private_foo_key. How the configuration file ~/.ssh/config can look like?

Hostname foo.example.com  
User jim

And that's all. Now we can execute "ssh foo.example" an it will be the same as "ssh jim@foo.example.com -i ~/.ssh/private_foo_key". Umm... that's nice. But we can do it better.

Hostname foo.example.com  
User jim

Now it's just enogh to type "ssh foo" (same as "ssh jim@foo.example.com -i ~/.ssh/private_foo_key".

Another interesting option is the ControlMaster. If you normally launch tree or four connections to the server, every time you execute the command "ssh foo" you are creating a new connectinon. You can avoid that using the MasterControl, that will start a new connection just in the first request, and then it will use this connection for the next uses of ssh or scp. For activating the control master is just needed add this two lines:

Hostname foo.example.com  
User jim  
IdentityFile ~/.ssh/private_foo_key  
ControlMaster auto

Now if you launch a ssh connection everything will works as always, but if you execute the command again, you'll have a shell almost instantanily. Another options such as automatic port forwarding when connecting to a remote server, compression level (can be deactivated in case of make big backups of data already compressed, for example)... can be found in the documentation.

Regards, Jan.