Create an SSH Config File and Save Connections

This blog post will show you how to create an SSH config file and save an SSH connection. and a config file can simplify the process of connecting to hosts.

Using an SSH config file, we can define the remote host details and use a simple name to connect to with specifying all the connection details.

Create File

We create a config file in our .ssh directory under our home directory. Below is the full path.


If the file doesn’t exist create it using the following command.

touch /home/yourusername/.ssh/config

Create a Connection

Now that we have our SSH config file, we have to create an SSH connection inside the file. Let go ahead and create a connection, as shown below:

Host myubuntuserver
  User adminuser
  IdentityFile ~/.ssh/id_rsa.key

In the above code, I added a connection with an SSH file. If you don’t use an SSH you can remove the IdentityFile.


To connect to my host I will run the following command:

ssh myubuntuserver

Success! You're on the list.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.