SSH config

ssh, config

When connecting to many different machines with SSH it is nice to don’t have to always remember user names, IP addresses, SSH-keys etc. Luckily there is a way to configure this.

The first thing to do is to create the config file

vim ~/.ssh/config

Here is an example of the syntax in the file

Host unoverse
  Hostname 1.2.3.4
  User oux
  Identityfile /path/to/ssh/key

Host - set to whatever you want, this is used as an alias to connect
Hostname - this is the IP or domain of the server you want to connect to
User - your username
Identityfile - the path to your SSH key

To connect to our server with our SSH key we can just type ssh unoverse which is equal to ssh -i /path/to/ssh/key oux@1.2.3.4.