Install NixOS on Hetzner Cloud: Difference between revisions

Use SSH key instead of password
No edit summary
Line 21: Line 21:
</syntaxhighlight>'''Note''': this is done in a container in order to reduce the "setup footprint and residue", allowing to throw away this setup environment quickly.
</syntaxhighlight>'''Note''': this is done in a container in order to reduce the "setup footprint and residue", allowing to throw away this setup environment quickly.
#Install <code>nix</code> and <code>hcloud</code> CLI utilities. Run:<syntaxhighlight lang="shell">
#Install <code>nix</code> and <code>hcloud</code> CLI utilities. Run:<syntaxhighlight lang="shell">
apk add nix hcloud
apk add nix hcloud openssh
</syntaxhighlight>
</syntaxhighlight>
#Authenticate <code>hcloud</code> CLI utility. Run:<syntaxhighlight lang="shell">
#Authenticate <code>hcloud</code> CLI utility. Run:<syntaxhighlight lang="shell">
Line 27: Line 27:
</syntaxhighlight>
</syntaxhighlight>
#When asked, enter value of the token in the prompt.  '''Note''': the token with "Read/Write" permissions can be obtained on a project page inside Hetzner Cloud: <nowiki>https://console.hetzner.cloud/projects/0000000/security/tokens</nowiki>
#When asked, enter value of the token in the prompt.  '''Note''': the token with "Read/Write" permissions can be obtained on a project page inside Hetzner Cloud: <nowiki>https://console.hetzner.cloud/projects/0000000/security/tokens</nowiki>
#Create an SSH key:<syntaxhighlight lang="sh">
ssh-keygen -t ed25519 -f /root/.ssh/id_ed25519 -N ''
</syntaxhighlight>
#Upload your public key to Hetzner:<syntaxhighlight lang="shell">
#Upload your public key to Hetzner:<syntaxhighlight lang="shell">
hcloud ssh-key create --name 'My public key' --public-key-from-file /path/to/my/public/key
hcloud ssh-key create --name 'My public key' --public-key-from-file /root/.ssh/id_ed25519
</syntaxhighlight>
</syntaxhighlight>
#Create a VM on Hetzner. Run:<syntaxhighlight lang="shell">
#Create a VM on Hetzner. Run:<syntaxhighlight lang="shell">