Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/ssh/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
通过SSH连接到计算机的私钥必须由运行Vagrant的用户拥有_Ssh_Vagrant - Fatal编程技术网

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

通过SSH连接到计算机的私钥必须由运行Vagrant的用户拥有,ssh,vagrant,Ssh,Vagrant,我正在努力学习这个流浪汉教程。在我的前两个命令之后,我得到了一个错误。我从命令行编写了这两个命令 $ vagrant init hashicorp/precise64 $ vagrant up 在我运行了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 f

我正在努力学习这个流浪汉教程。在我的前两个命令之后,我得到了一个错误。我从命令行编写了这两个命令

$ vagrant init hashicorp/precise64
$ vagrant up
在我运行了
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
然后,如果我运行任何命令,我会得到相同的错误。即使我运行了
vagrant ssh
,我也会收到相同的错误消息。请帮我解决这个问题


我在linux mint上,也在使用virutal box。

正如错误消息所示:

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

因此,请使用检查文件的权限

stat /media/bcc/Other/Linux/vagrant3/.vagrant/machines/default/virtualbox/private_key
检查您正在使用的用户

id

然后修改文件的所有者:

chown `whoami` /media/bcc/Other/Linux/vagrant3/.vagrant/machines/default/virtualbox/private_key

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

Jakuje有正确的答案-如果您正在使用的文件系统支持更改所有者

如果您试图从NTFS挂载vagrant box,则无法更改密钥文件的所有者

如果要在NTFS上装载文件,并且正在运行本地实例,可以尝试以下方法,这对我很有用:

游荡的停顿

[取下流浪者箱]

[将以下行添加到文件]

config.ssh.insert_key=false
[**您可能需要再次删除和克隆您的项目]

流浪准备金


此解决方案可能不适用于活动实例-它使用默认的不安全ssh密钥。如果您需要更高的安全性,您可能会在这里找到一个更令人满意的解决方案

它不能在非unix文件系统上运行,这让人非常沮丧。解决这个问题的一种方法是首先使用sudo(sudovargant-up)创建vm,然后使用sudovagrant-ssh将其ssh。
config.ssh.insert_key=false