Using SSH alias for a faster connection

Using SSH alias for a faster connection

You are probably using the following command when you are trying to connect to your server through SSH

ssh -i

Which is valid but if you currently manage a lot of ssh files for your different servers, at some point it will be hard to remember all of them. Fortunately, there is a simple way to save that time.

  1. Within your terminal, change the path to your .ssh folder
  2. Create a new file called config using nano config
  3. Inside that file, write the following code
Host secondserver
  User root
  IdentityFile C:\Users\Demo\.ssh\id_rsa_myserver

The strong text must be changed according your server details. And finally, the command you will use in order to establish the connection is:

ssh secondserver