I recently discovered a simple yet awesome SSH configuration file ~/.ssh/config
. If you configure it correctly, you can simply connect to your client via ssh client
instead of something like ssh -p 1234 user [at] client [dot] tld
. I use it for two days now and already love it A LOT!
So how do you configure this awesome shortcut? It is damn easy. Simply create the file ~/.ssh/config
or append to it:
Host client HostName 123.456.789.0 Port 1234 User user IdentityFile ~/.ssh/private_key_for_client
That is all! Port
and IdentityFile
are of course optional, so that it is only three lines of configuration in its simplest form. Awesome, right?
Big thanks to Matthew Haworth for the CLI talk given at Mage Titans UK 2017. It also includes other nice shortcuts, which you may find useful as well.