0
0

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 1 year has passed since last update.

Vagrant+VirtualBoxでvagrant sshでsshに入れなくなった時の対処

Posted at

VirtualBox+Vagrantで開発環境を作成してシステム開発をしています。
VagrantとVirtualBoxをタイトルのバージョンに上げたらvagrant sshで仮想マシンにsshで入ることができなくなってしまいました。

ソフトウェア バージョン
Vagrant 2.2.19
VirtualBox 6.1.48

現象

>vagrant ssh
Bad owner or permissions on C:\\Users\\myuser/.ssh/config

エラーメッセージに書いてある通り、configファイルへのアクセス権限が厳密でない為、エラーになっているようです。

対応

コマンドプロンプトを管理者で起動し、icaclsコマンドで内容を確認すると、複数のユーザにアクセス権があります。

cd C:\Users\myuser\.ssh
icacls config

実行結果
config NT AUTHORITY\SYSTEM:(I)(F)
       BUILTIN\Administrators:(I)(F)
       PC-NAME001\myuser:(I)(F)
       S-1-5-21-7777777777-8888888888-9999999999-1001:(I)(F)

自分のアカウントのみ読み書きができるように権限を再設定します。
configファイルのプロパティのセキュリティを見ても、自分だけになります。

cd C:\Users\myuser\.ssh
icacls cofig /reset
icacls config /grant: r myuser:(R,W)
icacls config /inheritance: r

対応結果

これで、今まで通りにvagrant sshで入れそうですが、パスワードを入力待ちになってしまします。
パスワードは、vagrantで良いようです。

vagrant ssh
vagrant@127.0.0.1'a password:

終わりに

以前は、vagrant sshでは、パスワードを入力しなくてもsshに入れたと思うんですが、そこ辺りは、今後の課題にしておこうと思います。

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

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?