SSH config file to the rescue

I’ve recently switched my hosting from single self-managed dedicated server at 1and1 to a managed virtual private data center on “the cloud” with ENKI consulting.  The benefits of the grid computing technology they are using are numerous, including improved security, automatic redundant failover, and great mangement and monitoring tools.

As part the improved security, each component of the system (webserver, database) runs in its own virtual machine, and only has the bare minimum access to files and other services that it needs.  When setting these up, I have to ssh to each component individually.  Access is provided to the seperate components by having a different ssh port on one externally available IP address.

Typing in “ssh -p 7543 dobes@543.32.54.32” with varying port numbers, usernames, and IP addresses can be a pain.  Today I found out that you can specify aliases in your ssh configuration that set up connection options, hostnames, and IP addresses.

Simply edit ~/.ssh/config and put sections like:

Host glassfish-live

HostName 543.32.54.32

Port 7543

User dobes

Compression on

IndentityFile  ~/.ssh/id_rsa_live

Each time ssh finds “Host” it treats the settings that follow as specific to that host, and “HostName” tells it the “real” host to connect to.  These aliases are a great shortcut and I was so pleased to discover them I couldn’t wait to share them.

Hope you make good use of this one …


One Response to SSH config file to the rescue

  1. nerds on site blog…

    […]SSH config file to the rescue « dobesland[…]…

%d bloggers like this: