website/content/blog/sshconfig.md

20 lines
759 B
Markdown
Raw Permalink Normal View History

2020-01-15 21:51:49 -05:00
---
title: "SSH Config"
date: 2019-09-27T22:46:39-04:00
draft: false
2020-02-29 19:39:20 -05:00
tags: [ "SSH" ]
2023-01-05 14:04:45 -05:00
medium_enabled: true
2020-01-15 21:51:49 -05:00
---
Have you ever gone through the hassle of having multiple public/private keys for accessing your remote servers? Before recently, I used to specify the identity file in all my transactions `ssh -I ~/.ssh/private_key user@host` but no longer! I discovered you can add the following to your `~/.ssh/config` to specify which key you want to use!
```
2020-01-16 20:03:34 -05:00
Host somename
2020-01-15 21:51:49 -05:00
Hostname someaddress
user usernameonserver
IdentityFile ~/.ssh/private_key
```
Of course you can add multiple of these entries in that file so that you can `ssh` without having to worry about explicitly using keys. Just keep in mind that the order of your entries matter.