How to login into a server with “ssh friendly_name”

After moving to an Ubuntu environment after using windows for mote than 10 years, I feel like this is it. I used to use softwares like SecureCRT and Putty in the windows time but now I want to embed deeply into the linux environment for it’s simple yet powerful infrastructure.

At first I could login into my debian based server using “ssh -p22 [email protected]” after putting my private ssh key into the .ssh folder of my current user. But writing that long string every time was hectic and I’ve to find an easier alternative to do it.

After reading some ubuntu specific forums I came to know about host based login, which is useful even if you’re using multiple servers at a time and want to login randomly into each other. It works like defining the commands you want to pass in a ssh_config file (be it a system wide or user specific) only once and then you can use some friendly name to login into your server like “ssh my-server”.

User ssh_config File Location: ~/.ssh/ssh_config

System ssh_config File Location: /etc/ssh/ssh_config

Open the desirable config file and put in the following example configuration:

Host linode
Hostname 132.32.14.23
Port 1234
User indude

You can find the list and descriptions of all parameters that can be specified in the host at http://www.openbsd.org/cgi-bin/man.cgi?query=ssh_config&sektion=5

Leave a comment

Your email address will not be published. Required fields are marked *