Making ssh remote sever call short

Hi Readers

I use Ubuntu 14.04 LTS. So this article will be around that. If you use different OS then you can simply google steps for your platform. I assume that this will work for all *nix systems.

If you always call $ ssh -i /<path to your ssh key>/<your ssh key>.ssh username@hostIP

There is short version of it like ssh username@hostname

For this what you need follow simple steps given below :-
  • Add your remote server private key to your system.
$ ssh-add /<path to your ssh key>/<your ssh key>
  • Add your ip address to system host file. Do this by
$ sudo vim /etc/hosts

I am using vim, you can use editor of your choice. Now add your remote server ip address and assign it a name. Like techiekunal

Save file and close editor. Now run this using

$ ssh username@techiekunal

You can do this for all your remote ssh connections. So now you have short version of your long ssh call and you can easily memorize it.