Creating different configurations for different hosts
For a change of pace, let’s look at the client’s end now. This time, we’ll look at a handy trick to help ease the pain of logging into different servers that require different keys or SSH options. This also allows you to access servers via easy-to-remember names, rather than having to remember multiple server IP addresses. All you have to do is go into the .ssh
directory in your own home directory and create a config
file. To demonstrate this, let’s create a configuration that allows us to easily access server1
. In the ~/.ssh/config
file, we can add a stanza that looks something like this:
Host server1
Hostname 192.168.0.8
User donnie
IdentityFile ~/.ssh/server1_id_rsa
IdentitiesOnly yes
ForwardX11 yes
Cipher [email protected]
Here’s the breakdown:
- Host: This is the common name that you can use in your login command.
- Hostname: For this, use either the IP address...