4 ms·
you can also specify which private key to present using IdentifyFile /path/to/key/file when I have different hosts that require different keys to access, this
by megavolcano 7y ago
you can also specify which private key to present using
IdentifyFile /path/to/key/file
when I have different hosts that require different keys to access, this is very useful so I don't have to specify them every time
and agent forwarding is useful as well, for example, I can push to github from a vm using my laptop ssh key and I don't have to generate an additional key for the vm
ForwardAgent true
with the new Windows terminal, I setup different tabs to be SSH to different machines based on my .ssh/config file
{
"guid": "{1c9b268e-7606-4a07-b097-d8bc62fb5207}",
"hidden": false,
"name": "ubuntu.localdomain",
"commandline": "ssh.exe me@ubuntu",
"colorScheme": "Elementary"
},
{
"guid": "{b7161acc-8235-4283-9a85-e93df3d09125}",
"hidden": false,
"name": "db.localdomain",
"commandline": "ssh.exe me@db",
"colorScheme": "Ubuntu"
},
Windows Terminal with a very nicely define ssh config is a killer combo.
- inetknght 7y agoIf you have more than one private key in your agent, then SSH will try each one sequentially. That can lead to mistakenly getting banned by monitoring software for what can appear indistinguishable to be an authentication attack. Not to mention the wrongness of presenting "any and all keys" to any host you connect to. If you have multiple keys in your agent, you _really_ should manually configure what key to present using `-i` or `IdentityFile`. But you should also use `IdentitiesOnly` too.
- megavolcano 7y agothanks for the tips!
- emmelaich 7y agoYou should use at least a different IdentityFile for each realm -- publc, personal, work. So definitely have a custom ~/.ssh/config Possibly a different key for each machine, especially public because your public key can be used to identify you.
- efreak 7y agoYou can also specify port, so if you're doing crazy things like running multiple sshd in WSL, VMs, and windows on the same machine you can still connect them easily. My only wish is that there was a way to define a backup hostname/IP of the first is down (my laptop has different IP on local WiFi, local wired, remote) and a way to specify multiple names for a host (on PC, I usually use NAS or the full IP address; on my phone I usually just use the last octet or lowercase nas); it would be nice to have the same file configured and in use across all my devices, with only a single configuration block for each.