#
ドキュメント

Document

自分のための備忘録です。

SSHの流れ

キーペア作成

※ ファイル名を変更するにはfオプションでファイル名をフルパス指定します。
ファイル名を指定しない場合は、秘密鍵が$HOME/.ssh/id_ed25519、公開鍵が$HOME/.ssh/id_ed25519.pubになります。
RSA形式も同様にファイル名を指定しない場合は秘密鍵が$HOME/.ssh/id_rsa、公開鍵が$HOME/.ssh/id_rsa.pubになります

ed25519形式

$ ssh-keygen -t ed25519 -C "your_email@example.com"

RSA形式

$ ssh-keygen -t rsa -b 4096 -C "your_email@example.com"

ref. https://docs.github.com/en/authentication/connecting-to-github-with-ssh/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent

公開鍵をサーバーに設定

# 公開鍵は id_ed25519.pub とする
$ cat ~/.ssh/id_ed25519.pub >> ~/.ssh/authorized_keys