Setting up a SSH Config File
From time to time there are occasions where I need to SSH to a server. In the past when I was on a Windows machine I would use Putty. Now that I’m using Linux on a day to day basis. I can no longer use Putty I wasn’t to keen on using the traditional way of ssh [email protected]_host. As I have several servers and I don’t always have the IP Addresses and usernames to hand. So i’m going to demonstrate how to connect to server using a SSH config file.
In the terminal enter the command above to go to the SSH folder
The command above creates the config file. This is where we will place all the SSH connection information
Host production HostName example.com User MYUSER IdentityFile /home/MYMACHINE/.ssh/KEY
Open up the config file which we just created and add in the information above replacing the information with your server configuration and then save the file. If you need multiple instances just duplicate the host file block will your server credentials.
Back on the terminal enter the command above. If you added a IdentityFile you be prompted to enter your passphase key or password if you not using IdentityFile. If all worked you should be connected to your server.
As you can see this method of connecting using a SSH config file is much more easier than having to remember login credentials. Here is a list of information what can be added to your config file.