The OpenSSH config file
When utilizing SSH for the first time, the .ssh
directory will be created in your home directory. This directory contains useful files for your SSH client, which include known_hosts
, id_rsa
, and id_rsa.pub
once you generate your keys (which we will do later). While we will discuss those files later on in this chapter, there is another file that the SSH client recognizes: config
. This file is not created by default. If you create it yourself (following the proper syntax), then SSH will recognize it. So, what does this config
file do? If you have one or more hosts that you connect to frequently, you can fill this file with the specifics for each host without having to enter the details each time. Let's look at an example ~/.ssh/config
file.
Host icarus Hostname 10.10.10.76 Port 22 User jdoe Host daedalus Hostname 10.10.10.88 Port 65000 User duser Host dragon Hostname 10.10.10.99 Port 22 User jdoe
For this file, SSH will recognize three hosts straight away: Icarus...