4
4

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.

Vagrant で SSH の接続ができない:Authentication failure

Last updated at Posted at 2016-09-13

※ 完全に解決してないです →解決したと思われる(追記2

環境:Vagrant 1.8.5 + VirtualBox 5.1.4 + CentOS 6.8

SSH のエラーということで鍵まわりを探っていたのですが、特に問題なさそうな雰囲気 ……

仮説:sudo しなきゃいけないところがあったのが問題?
対処: synced_folder/var/www/project_name に設定していたのですが、 /var/www が存在しなかった。

そこで、 vagrant ssh して VirtualBox 内で

sudo mkdir -p /var/www/project_name
sudo chown -R vagrant /var/www
sudo chmod +x /var/www
exit

してみたあと、 vargant reload --provision で、動作している様子だった。

ただし、上記の対処が良くて動作したのかどうかの確証はないです ……

追記1

  • synced_folder を削除しみてみる→ダメだった
  • synced_folder/home/vagrant/project_name にしてみる→ダメだった
  • 一旦、VMを削除したあと、上記の対応→ダメだった ……

そこで、 vagrant ssh して VirtualBox 内で以下を行った。

sudo chown vagrant ~/.ssh/authorized_keys
sudo chmod 0600 ~/.ssh/authorized_keys
exit

動いた!

synced_folder を作る作業と鍵のパーミッションを変更する作業の両方が必要なのかをまだ試してないです。

追記2

やはり、 Vagrant1.8.5 のバグ(?)が原因だった様子。
以下の手順で動作しそう。

$ vagrant up
default: Warning: Authentication failure. Retrying...
default: Warning: Authentication failure. Retrying...

上記の状態になったら、 Ctr+c で抜ける。

vagrant ssh (パスワードは vagrant

VirtualBox 内で以下を行う。

chmod 0600 ~/.ssh/authorized_keys
exit

vagrant reload

追記3

以下を参考に Vagrant へ修正を入れておいたほうが良さそうです。

Vagrant 1.8.5 でAuthentication failure. Retrying…というエラーが発生するときの対処方法 | Crane & to.

4
4
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
4

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?