通过SSH连接到计算机的私钥必须由运行Vagrant的用户拥有

3 ssh vagrant

我正在尝试遵循这个流浪教程.我的前两个命令后出错了.我从命令行写了这两个命令

$ vagrant init hashicorp/precise64
$ vagrant up
Run Code Online (Sandbox Code Playgroud)

在我运行vagrant up命令后,我得到了这条消息.

The private key to connect to the machine via SSH must be owned
by the user running Vagrant. This is a strict requirement from
SSH itself. Please fix the following key to be owned by the user
running Vagrant:

/media/bcc/Other/Linux/vagrant3/.vagrant/machines/default/virtualbox/private_key
Run Code Online (Sandbox Code Playgroud)

然后,如果我运行任何命令,我会得到相同的错误.即使我运行,vagrant ssh我得到相同的错误消息.请帮我解决问题.

我是在linux薄荷和使用虚拟盒子.

Jak*_*uje 5

正如错误消息告诉您的那样:

通过SSH连接到计算机的私钥必须由运行Vagrant的用户拥有.

因此请检查文件的权限

stat /media/bcc/Other/Linux/vagrant3/.vagrant/machines/default/virtualbox/private_key
Run Code Online (Sandbox Code Playgroud)

检查您正在使用的用户

id
Run Code Online (Sandbox Code Playgroud)

要么

whoami
Run Code Online (Sandbox Code Playgroud)

然后修改文件的所有者:

chown `whoami` /media/bcc/Other/Linux/vagrant3/.vagrant/machines/default/virtualbox/private_key
Run Code Online (Sandbox Code Playgroud)

请注意,如果您的/ media/bbc /是一些不支持Linux权限的非Linux文件系统,则可能无法实现.在这种情况下,您应该为您的私钥选择更合适的位置.