公開鍵暗号方式の秘密鍵をアルゴリズム:ed25519を使って1行で作る方法を記載する
環境
・Ubuntu 20.04
作成方法
$ ssh-keygen -t ed25519 -N '' -f ~/.ssh/id_ed25519 Generating public/private ed25519 key pair. Your identification has been saved in /home/ubuntu/.ssh/id_ed25519 Your public key has been saved in /home/ubuntu/.ssh/id_ed25519.pub The key fingerprint is: SHA256:J2cNTB7k6MqobfztNBHV7ujqD4oXTjoQziq9bnzy8ZE ubuntu@<host名> The key's randomart image is: +--[ED25519 256]--+ | .=. | | B .. | | o =. | | . . . o. | | o . S +o. | | + ooo *. . | | + oo+E.+. | |o =o*+o= o. | |.o+*+++o=o. | +----[SHA256]-----+
確認
$ cat ~/.ssh/id_ed25519.pub ssh-ed25519 <秘密鍵> ubuntu@<host名>
個人的にはデフォルトで指定される暗号方式のアルゴリズムであるRSAより、 ed25519のほうが文字列の長さが短いから好きである。