2016-08-24 108 views
1

我试过

启动一个CentOS 7虚拟机。下面是我的设置警告:身份验证失败。正在重试

流浪文件

# -*- mode: ruby -*- 
# vi: set ft=ruby : 

VAGRANTFILE_API_VERSION = "2" 

Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| 

    config.vm.define "zabbix1" do |zabbix1| 
    zabbix1.vm.box = "centos/7" 
    zabbix1.vm.hostname = "zabbix1" 
    zabbix1.ssh.insert_key = false 
    zabbix1.vm.network :private_network, ip: "10.11.12.55" 
    zabbix1.ssh.private_key_path = "~/.ssh/id_rsa" 
    zabbix1.ssh.forward_agent = true 
    end 


end 

结果

流浪汉重装

==> zabbix1: Attempting graceful shutdown of VM... 
    zabbix1: Guest communication could not be established! This is usually because 
    zabbix1: SSH is not running, the authentication information was changed, 
    zabbix1: or some other networking issue. Vagrant will force halt, if 
    zabbix1: capable. 
==> zabbix1: Forcing shutdown of VM... 
==> zabbix1: Checking if box 'centos/7' is up to date... 
==> zabbix1: Clearing any previously set forwarded ports... 
==> zabbix1: Fixed port collision for 22 => 2222. Now on port 2204. 
==> zabbix1: Clearing any previously set network interfaces... 
==> zabbix1: Preparing network interfaces based on configuration... 
    zabbix1: Adapter 1: nat 
    zabbix1: Adapter 2: hostonly 
==> zabbix1: Forwarding ports... 
    zabbix1: 22 (guest) => 2204 (host) (adapter 1) 
==> zabbix1: Booting VM... 
==> zabbix1: Waiting for machine to boot. This may take a few minutes... 
    zabbix1: SSH address: 127.0.0.1:2204 
    zabbix1: SSH username: vagrant 
    zabbix1: SSH auth method: private key 
    zabbix1: Warning: Remote connection disconnect. Retrying... 
    zabbix1: Warning: Remote connection disconnect. Retrying... 
    zabbix1: Warning: Remote connection disconnect. Retrying... 
    zabbix1: Warning: Authentication failure. Retrying... 
    zabbix1: Warning: Authentication failure. Retrying... 
    zabbix1: Warning: Authentication failure. Retrying... 
    zabbix1: Warning: Authentication failure. Retrying... 
    zabbix1: Warning: Authentication failure. Retrying... 
    zabbix1: Warning: Authentication failure. Retrying... 

流浪汉SSH-配置

Host zabbix1 
    HostName 127.0.0.1 
    User vagrant 
    Port 2204 
    UserKnownHostsFile /dev/null 
    StrictHostKeyChecking no 
    PasswordAuthentication no 
    IdentityFile /Users/bheng/.ssh/id_rsa 
    IdentitiesOnly yes 
    LogLevel FATAL 
    ForwardAgent yes 

我做了什么错?我错过了什么 ?

+0

试试这个解决方案[Vagrant ssh authentication failure](http :?//stackoverflow.com/questions/22922891/vagrant-ssh-authentication-failure RQ = 1)。 – k0chan

回答

0

专用网络可以手动配置或使用VirtualBox内置DHCP服务器进行配置。这对我有用。

VAGRANTFILE_API_VERSION = "2" 

Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| 
    config.vm.define "zabbix1" do |zabbix1| 
     zabbix1.vm.box = "centos/7" 
     zabbix1.vm.hostname = "zabbix1" 
     zabbix1.ssh.insert_key = false 
     zabbix1.vm.network :private_network, type: "dhcp" 
    end 
end 

接下来,您必须使用游民destory无业游民了

+0

我更新了我的帖子,并添加了我的'vagrant ssh-config'的结果。 – ihue

+0

您在Vagrantfile中只有一台定义的机器“zabbix”吗? – k0chan

+0

如果你愿意,我可以告诉你我的整个流浪文件。 :) – ihue

3

我有同样的盒子,我固定它是登录到虚拟机从VirtualBox的(流浪者/游民作为用户名/密码)的方式,同样的问题,改变.ssh/authorized_keys

chmod 0600 .ssh/authorized_keys 

。执行权限你运行vagrant up后(而错误重复),虚拟机启动,你会看到vagrant up将成功完成,你将能够ssh进入虚拟机从vagrant ssh