Using short server names - 08-12-20

It use to be when I was trying to ssh into one of my servers I would just: in the shell to get my fzz backwards command search, type ssh, then scroll up and down until I found the correct server. As my number of servers has grown this is no longer manageable because I don’t remember which IPs align with with server. Time for some human readable names.

By adding something like this to your ~/.ssh/config:

Host de1
    HostName vxxxxxxxxxxxxxxxxxxxx.megasrv.de
    User travis

Host de2
    HostName vyyyyyyyyyyyyyyyyyyyymegasrv.de
    User travis

Host de3
    HostName vzzzzzzzzzzzzzzzzzzz.megasrv.de
    User travis

Host nyc1
    HostName 123.123.123.1233
    User travis

sshing becomes as easy as:

$ ssh de2

source – https://www.techrepublic.com/article/how-to-use-per-host-ssh-configuration/

\- [ ssh ]