4
6

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

VMでホストマシンの秘密鍵をゲストマシンと共有する

4
Last updated at Posted at 2016-05-17

1. はじめに

  1. ssh-agentが起動している必要あり。
    (Macの場合は最初から入っていて、起動もしてるので何もしなくてOK)

  2. 秘密鍵の生成が終わっていること(ここでは ~/.ssh/id_rsa として説明)

2. ホストマシン側で以下のコマンドを実行

ssh-add -K ~/.ssh/id_rsa

3. ゲストマシン側で見えるか確認

vagrant起動ファイル(Vagrantfile)に以下を追加しておき、 vagrant up

config.ssh.forward_agent = true

ゲストOSにログインし、以下コマンドで秘密鍵が表示されれば共有完了

ssh-add -l
4
6
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
4
6

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?