【问题标题】:When using Vagrant up, the password is always entered incorrectly使用Vagrant up时,密码总是输入错误
【发布时间】:2018-03-02 20:19:35
【问题描述】:

使用Vagrant up时,密码总是输入错误,我的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 up:

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,一直无法让我通过,是什么原因?

密码不能通过是什么原因,请问如何解决。

【问题讨论】:

  • 您是否在虚拟机中创建了这些用户?如果不是,你不应该假设它们存在
  • 未创建,如何创建?
  • 在 google 中搜索“在 ubuntu 中创建用户”
  • 创建用户后先进入ubuntu?但现在我无法到达那里
  • 所以删除 config.ssh.usernameconfig.ssh.password - vagrant 会自动连接到默认用户

标签: ubuntu ssh vagrant virtualbox


【解决方案1】:

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

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2015-09-27
    • 2016-09-04
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-01-27
    • 2020-02-22
    相关资源
    最近更新 更多