使用Vagrant时,密码始终输入错误

时间:2017-09-21 12:59:59

标签: ubuntu ssh vagrant virtualbox

使用Vagrant时,密码总是输入错误,我的Vagrantfile文件:

Vagrant.configure(2) do |config|

  config.vm.define "k8s-ctl" do |c|
    config.vm.box = "ubuntu/xenial64"
    config.ssh.username = "myhtls"
    config.ssh.password = "123456"
    config.ssh.insert_key = false
    c.vm.network "public_network"
    end

  config.vm.define "k8s-master" do |c|
    config.vm.box = "ubuntu/xenial64"
    config.ssh.username = "myhtls"
    config.ssh.password = "123456"
    config.ssh.insert_key = false
    c.vm.network "public_network"
    end

end

在doc中,输入命令vagrant:

Bringing machine 'k8s-ctl' up with 'virtualbox' provider...

Bringing machine 'k8s-master' up with 'virtualbox' provider...

==> k8s-ctl: Importing base box 'ubuntu/xenial64'...

==> k8s-ctl: Matching MAC address for NAT networking...

==> k8s-ctl: Checking if box 'ubuntu/xenial64' is up to date...

==> k8s-ctl: Setting the name of the VM: deploy_k8s-ctl_1505998038511_39277



    k8s-ctl: SSH address: 127.0.0.1:2222

    k8s-ctl: SSH username: myhtls

    k8s-ctl: SSH auth method: password



myhtls@127.0.0.1's password: 

我输入密码123456,一直无法让我通过,是什么原因?

无法传递密码的原因是什么,请问如何解决这个问题。

1 个答案:

答案 0 :(得分:0)

/Users/myhtls/.vagrant.d/boxes/ubuntu-VAGRANTSLASH-xenial64/20170919.0.0/virtualbox/Vagrantfile中的密码从虚拟机登录到ubuntu。然后添加vagrant用户和密码,即可登录doc