Manage your hostnames with SSH Config
Logging into a remote server from your terminal could be a pain if you use the ssh command with the options of your private key, username and stuff. Fortunately, you can create a config file for your hostnames.
Let’s say that I want to log on a remote server called dummy.com with the username flotz and a private key found in ~/.ssh/private.key. The SSH command would be:
Well, I will make my life easier by creating a config file for that hostname:
And now I can remotely connect by simply typing ssh dummy
.
You might want to add more options like the Port or maybe the ForwardAgent if you work with git.
Pro-tip: you can add more than one Host as long as you separate them with whitespaces: