I often need to remotely connect to my workstation in the lab via
ssh. Each time I log in, I found myself retyping the command:
ssh firstname.lastname@example.org which could be quite tedious.
In one of my previous blog post, I have already outlined how we can securely connect to a remote terminal without having to re-type the password each time we login. There is a neat little trick that allows us to cut short the time to connect even further. Suppose I want to simply type
ssh ws1 instead of
ssh email@example.com, then just do as follows:
Step 1: Fire up a bash terminal in Linux and change directory the (hidden) ssh folder:
$ cd ~/.ssh
Step 2: Using your favorite text editor (I prefer nano), create a file called config (without any file extensions):
$ nano config
Step 3: Edit this file and add the following:
Save this file. So, now you should now be able to connect to server
username using your private ssh key file named
id_key. This assumes you have already copied your ssh public key to the server using the method outlined in my previous blog post.
Step 4: Now, try issuing the command
$ ssh ws1 . You should be connected to your remote server!