LoginSignup
12
17

More than 5 years have passed since last update.

vagrantで構築した仮想環境(vm)にSSHログイン設定(not vagrant ssh)

Last updated at Posted at 2015-07-25

正直自分用メモです、あしからず。

 やりたいこと

vagrant ssh 

ではなく、

ssh username@hostname #要は、公開鍵認証

みたく、ログインできるようにしたく。。。
※ログインユーザーは事前にvm側で作成してあるものとする

手順

ホストマシン作業
$ vagrant up
$ vagrant ssh-config --host hostname # ssh接続情報表示
Host hostname
  HostName 127.0.0.1
  User vagrant
  Port 2222
  UserKnownHostsFile /dev/null
  StrictHostKeyChecking no
  PasswordAuthentication no
  IdentityFile 
$ vagrant ssh-config --host hostname >> ~/.ssh/config # confに設定
$ ssh username@hostname #sshログイン
username@hostname's password:
Last login: Sat Jul 25 20:37:08 2015 from 192.168.33.1
[username@hostname ~]$

参考

12
17
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
12
17