无法在基础初始化中使用 Vagrant SSH 密钥连接(authorized_keys 权限问题)

Cannot make Vagrant SSH key-using connection in base initializing (authorized_keys permission issue)

我已尝试唤醒基本 VM bento/centos-67

$ vagrant version
Installed Version: 1.8.5
Latest Version: 1.8.5

You're running an up-to-date version of Vagrant!

$ vagrant init bento/centos-6.7; vagrant up --provider virtualbox; vagrant up
A `Vagrantfile` has been placed in this directory. You are now
ready to `vagrant up` your first virtual environment! Please read
the comments in the Vagrantfile as well as documentation on
`vagrantup.com` for more information on using Vagrant.
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Importing base box 'bento/centos-6.7'...
==> default: Matching MAC address for NAT networking...
==> default: Checking if box 'bento/centos-6.7' is up to date...
==> default: Setting the name of the VM: bento_default_1473166306806_14580
==> default: Fixed port collision for 22 => 2222. Now on port 2200.
==> default: Clearing any previously set network interfaces...
==> default: Preparing network interfaces based on configuration...
    default: Adapter 1: nat
==> default: Forwarding ports...
    default: 22 (guest) => 2200 (host) (adapter 1)
==> default: Booting VM...
==> default: Waiting for machine to boot. This may take a few minutes...
    default: SSH address: 127.0.0.1:2200
    default: SSH username: vagrant
    default: SSH auth method: private key
    default:
    default: Vagrant insecure key detected. Vagrant will automatically replace
    default: this with a newly generated keypair for better security.
    default:
    default: Inserting generated public key within guest...
    default: Removing insecure key from the guest if it's present...
    default: Key inserted! Disconnecting and reconnecting using new SSH key...
    default: Warning: Authentication failure. Retrying...
    default: Warning: Authentication failure. Retrying...
    default: Warning: Authentication failure. Retrying...

但同时我可以使用 vagrant ssh 和密码 vagrant

那么,怎么了?..

相关问题:#1

(也向 chef 报告了该问题)

修复

问题是:具有 public 密钥的 ~/.ssh/authorized_keys 文件具有 644 权限,但必须是 600

$ ssh vagrant@127.0.0.1 -p 2200 # use password "vagrant"
[vagrant@localhost ~]$ chmod 600 ~/.ssh/authorized_keys

现在vagrant ssh可以不用问了

问题是为什么它不能开箱即用?出了什么问题?我教过它如何正确定义 authorized_keys 文件? oO

也许这与 the vagrant bug 有关。

这绝对是您链接到的 Vagrant 错误,而不是 Bento 盒子。我是 Bento box 的维护者,我们已经在我们的管道中退回到 Vagrant 1.8.4。