snippets/old_snippets/short-server-names.en.md

41 lines
948 B
Markdown

---
title: "using short server names"
date: 2020-08-12T12:04:32+02:00
draft: false
snippet_types:
- ssh
---
It use to be when I was trying to ssh into one of my servers I would just: <Ctrl><r> 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:
```shell
$ ssh de2
```
source -- https://www.techrepublic.com/article/how-to-use-per-host-ssh-configuration/