LoginSignup
10
13

More than 5 years have passed since last update.

SSHキー生成の仕方

Posted at

新MacBookPro購入記念。
SSHキー生成方法忘れてたので、備忘録兼ねて記録。

~/.ssh へ移動

$ cd ~/.ssh

RSAキー生成コマンド

$ ssh-keygen -t rsa
Generating public/private rsa key pair.

これで、~/.ssh に2種類の鍵が生成されます。

  • id_rsa(秘密鍵)
  • id_rsa.pub(公開鍵)

以下、エンター3回

なにも考えてないです。

Enter file in which to save the key (~/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:

(以下略)

ちゃんと作られたか確認

$ ls
id_rsa      id_rsa.pub  known_hosts

OK!

おまけ

鍵をコピーしたいとき(Mac)。

$ pbcopy < ~/.ssh/id_rsa.pub
10
13
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
10
13