add the old snippet md files
This commit is contained in:
parent
fc0dd204c7
commit
bcf8313a4b
110 changed files with 3048 additions and 0 deletions
44
old_snippets/auto-find-ssh-keys.en.md
Normal file
44
old_snippets/auto-find-ssh-keys.en.md
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
---
|
||||
title: "auto find ssh keys"
|
||||
date: 2020-08-12T12:14:15+02:00
|
||||
draft: false
|
||||
snippet_types:
|
||||
- ssh
|
||||
---
|
||||
|
||||
I use to always pass a key when sshing ex:
|
||||
|
||||
```shell
|
||||
$ ssh -i ~/.ssh/de2 travis@vxxxxxxxxxxxxxxxxxxx.megasrv.de
|
||||
```
|
||||
That can be a bit annoying. I know two fixes:
|
||||
|
||||
# add private key to ssh-agent
|
||||
|
||||
```shell
|
||||
$ ssh-add ~/.ssh/de2
|
||||
```
|
||||
|
||||
Now when you ssh you need not include the `-i ~/.ssh/de2` because the ssh-agent will find it
|
||||
automatically.
|
||||
|
||||
*\*note: this resets once you reboot*
|
||||
|
||||
# configure individual host
|
||||
|
||||
You can configure individual hosts to use a spefic private key my editing your `~/.ssh/config`:
|
||||
|
||||
```
|
||||
Host de2
|
||||
HostName vxxxxxxxxxxxxxxxxxxxx.megasrv.de
|
||||
User travis
|
||||
IdentityFile ~/.ssh/de2
|
||||
```
|
||||
|
||||
Now you only need to
|
||||
|
||||
```shell
|
||||
$ ssh de2
|
||||
```
|
||||
|
||||
source -- https://www.techrepublic.com/article/how-to-use-per-host-ssh-configuration/
|
||||
Loading…
Add table
Add a link
Reference in a new issue