Setting SSH Client Configuration Options For a Host

You can set up Host entries in the $HOME/.ssh/config file on a client system. Often usernames don't align on different systems. Sometimes you might choose to use a different key pair to the usual key pair for a particular remote system. To connect more easily with the correct credentials, you can add a host entry similar to the following example:

Host server1
  Hostname server1.example.com
  User remote_user
  IdentityFile $HOME/.ssh/id_sshkeyexample

With the provided configuration entry, the user can run:

ssh server1

The SSH client performs a connection to the remote server server1.example.com with the username remote_user and uses the private key file at $HOME/.ssh/id_sshkeyexample.

This configuration entry lets you connect with the correct credentials each time you want to connect. Without the configuration entry, you would need to enter the following:

ssh -i $HOME/.ssh/id_sshkeyexample remote_user@server1.example.com 

You can use the $HOME/.ssh/config file to store other configuration options for any system that you connect to. For example, if you use the ForwardAgent or ProxyJump options often, consider adding entries for these for each host where you use them. See the ssh_config(5) manual page for more information.