Tired of writing hostnames and ports when using ssh? Then start using ssh config file!
I’ve recently found out that there is the possibility to define frequently used hosts in an ssh configuration file which get’s looked up each time you use ssh.
Here’s an example of a ssh config entry:
Host raspberry HostName 192.168.1.10 # hostname used by ssh User root IdentityFile ~/.ssh/rasp.key #or Host ftpserver HostName myhostname.domain.me User vince
Of course there are a lot of other options, one that I use frequently is the ProxyCommand, which allows you to specify the ssh command to be executed. In my case I use this when I need to connect to a host using a second machine, so for example : my_pc -> jump_machine -> final_destination. Also showed in the image here below:
This can be achived with this set-up:
Host final_destination User vince ProxyCommand ssh -q -l myusername -W final_destination:22 jump_machine
So there you go! A complete list of possible options/attributes for your ssh config file can be found here.