起初我收到了这个错误:
文字将以清晰的方式回显。请安装HighLine或 Termios库可以抑制回显文本。
vagrant@127.0.0.1' s密码:
然后我安装了: HighLine
现在我只得到:
vagrant@127.0.0.1' s密码:
我尝试使用 vagrant 有密码。
我没有工作。我试过我的电脑密码,它也没用。
所以我不知道我应该使用什么密码。
所有这一切都是在我添加这些设置后开始的(在 Vagrantfile 中):
config.ssh.username = "vagrant"
config.ssh.password = "vagrant"
config.ssh.keys_only = true
config.ssh.insert_key = true
有人可能会问我为什么要使用这些设置(因为通常 vagrant 是默认的用户名和密码)。原因是由于某种原因,该框生成一些随机密码并使用 ubuntu 具有用户名。
# Front load the includes
include_vagrantfile = File.expand_path("../include/_Vagrantfile", __FILE__)
load include_vagrantfile if File.exist?(include_vagrantfile)
Vagrant.configure("2") do |config|
config.vm.base_mac = "02357F2D68C4"
config.ssh.username = "ubuntu"
config.ssh.password = "1547c59e6cbdffd4104ad720"
config.vm.provider "virtualbox" do |vb|
vb.customize [ "modifyvm", :id, "--uart1", "0x3F8", "4" ]
vb.customize [ "modifyvm", :id, "--uartmode1", "file", File.join(Dir.pwd, "ubuntu-zesty-17.04-cloudimg-console.log") ]
end
end
这可以在~/.vagrant.d/boxes/ubuntu-VAGRANTSLASH-zesty64/20170412.1.0/virtualbox
我尝试了这个解决方案而且没有用:
vagrant asks password at only the first time 'vagrant up'
那么密码是什么? 我该怎么办才能停止询问密码?
Vagrant 1.9.1
本地操作系统:
没有可用的LSB模块。
经销商ID:Ubuntu
描述:Ubuntu 17.04
发布:17.04
Codename:zesty
Box:ubuntu / zesty64(virtualbox,20170412.1.0)
更新1
$ vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Box 'ubuntu/zesty64' could not be found. Attempting to find and install...
default: Box Provider: virtualbox
default: Box Version: >= 0
==> default: Loading metadata for box 'ubuntu/zesty64'
default: URL: https://atlas.hashicorp.com/ubuntu/zesty64
==> default: Adding box 'ubuntu/zesty64' (v20170412.1.0) for provider: virtualbox
default: Downloading: https://vagrantcloud.com/ubuntu/boxes/zesty64/versions/20170412.1.0/providers/virtualbox.box
==> default: Successfully added box 'ubuntu/zesty64' (v20170412.1.0) for 'virtualbox'!
==> default: Importing base box 'ubuntu/zesty64'...
==> default: Matching MAC address for NAT networking...
==> default: Checking if box 'ubuntu/zesty64' is up to date...
==> default: Setting the name of the VM: -----
==> default: Clearing any previously set network interfaces...
==> default: Preparing network interfaces based on configuration...
default: Adapter 1: nat
default: Adapter 2: hostonly
==> default: Forwarding ports...
default: 3306 (guest) => 3306 (host) (adapter 1)
default: 22 (guest) => 2222 (host) (adapter 1)
==> default: Running 'pre-boot' VM customizations...
==> default: Booting VM...
==> default: Waiting for machine to boot. This may take a few minutes...
default: SSH address: 127.0.0.1:2222
default: SSH username: vagrant
default: SSH auth method: password
default: Warning: Connection reset. Retrying...
default: Warning: Remote connection disconnect. Retrying...
vagrant@127.0.0.1's password:
vagrant@127.0.0.1's password:
default: Warning: Authentication failure. Retrying...
vagrant@127.0.0.1's password: ==> default: Waiting for cleanup before exiting...
Vagrant exited after cleanup due to external interrupt.
答案 0 :(得分:5)
我认为你有些困惑。
config.ssh.username
会引用用户登录,但此用户必须存在在VM中,您无法决定使用自己的名称,它会起作用;如果VM中没有相应的用户,则无法正常工作。
Vagrant建议使用基于密钥的身份验证而不是密码,但在创建邮箱时(通常使用packer.io),您可以决定使用密码身份验证方法。
对于ubuntu / zesty64框,这就是所有者决定做的事情,它只创建了ubuntu用户,并决定使用密码进行身份验证。
如果您更喜欢使用vagrant登录VM,首先需要创建vagrant
用户,也可以下载public key。进行这些更改后,您可以重新打包该框,以便将来重新使用时,将保留所有设置。
您还可以使用打包器来构建自己的盒子,github上有大量可用的模板供您重复使用。
答案 1 :(得分:4)
Vagrant官方文档说明'vagrant'用户有一个默认密码
vagrant
本身。
转到他们的Official Website了解更多信息