7
8

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 up 時に出る default: Warning: Authentication failure. Retrying... の解決法

Posted at

前提

  • ただvagrant upしてるだけなのに、2回目以降の起動時にこれ↓で詰まってしまうときに見るメモ
    default: SSH username: vagrant
    default: SSH auth method: private key
    default: Warning: Authentication failure. Retrying...
    default: Warning: Authentication failure. Retrying... 
    default: Warning: Authentication failure. Retrying... 
    default: Warning: Authentication failure. Retrying... 
    default: Warning: Authentication failure. Retrying... 

解決策 1 パーミッション(権限)を見直す

  • 権限を確認すべき対象は3つ
  • 自分以外に権限を与えていたらNG (home/vagrantについては755まで大丈夫)
    • /home/vagrant
    • /home/vagrant/.ssh
    • /home/vagrant/.ssh/authorized_keys
Windows:
> vagrant ssh

vagrant:
$ chmod 755 /home/vagrant/
$ chmod 700 /home/vagrant/.ssh/
$ chmod 600 /home/vagrant/.ssh/authorized_keys

Windows:
> vagrant reload
  • 無事に再起動、しなければ別の問題

解決策 2 公開鍵ファイル(authorized_keys)があるか確認する

  • 誤操作や共有フォルダ設定などによって、稀に消してしまっている場合があるので確認する
Windows:
> vagrant ssh

vagrant:
$ ll .ssh/
total 4
-rw------- 1 vagrant vagrant 389 Jan 31 10:49 authorized_keys ←このファイル
  • もしもauthorized_keysがなかった場合は、vagrant destroyでvagrantごと作り直すか、下記手順でファイルだけを作り直す。
Windows:
> vagrant ssh-config
Host default
  HostName 127.0.0.1
  User ****
  Port ****
  UserKnownHostsFile /dev/null
  StrictHostKeyChecking no
  PasswordAuthentication no
  IdentityFile c:/***/private_key ←これをコピー
  IdentitiesOnly yes
  LogLevel FATAL
> ssh-keygen -yf c:/***/private_key > public_key
  • 作成されたpublic_keyファイルの中身をコピー
Windows:
> vagrant ssh

vagrant:
$ vi .ssh/authorized_keys

public_keyファイルの中身 + (半角スペース) + (vagrant) という中身にして保存

Windows:
> vagrant reload
  • 無事に再起動、しなければ別の問題
7
8
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
7
8

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?