ssh into Hetzner VMs with an ssh key

During VM creation, assuming you added an ssh public key value when prompted:

Add an entry like the following to your ~/.ssh/config:

Host ip-of-your-new-vm
PreferredAuthentications publickey
IdentityFile ~/.ssh/name-of-your-private-key

ssh into your VM with:

ssh root@ip-of-your-new-vm

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.