I have successfully created a custom Vagrant box, based on the official ubuntu/xenial64 Vagrant box, but I get this message when I attempt to use vagrant ssh
:
==> default: The machine you're attempting to SSH into is configured to use
==> default: password-based authentication. Vagrant can't script entering the
==> default: password for you. If you're prompted for a password, please enter
==> default: the same password you have configured in the Vagrantfile.
The only change to the box is to provision it with NginX. I then use...
vagrant package --vagrantfile <path_to_vagrantfile> --output nginx.box
... where <path_to_vagrantfile>
is, in my case, /home/blackslate/.vagrant.d/boxes/ubuntu-VAGRANTSLASH-xenial64/20170822.0.0/virtualbox/Vagrantfile
. I follow this with:
vagrant box add nginx nginx.box
I then create a new directory and use vagrant init nginx
to create a new instance of the box. The whole process is described in this question.
When I use vagrant up
, all appears to be running as expected:
vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Importing base box 'nginx'...
==> default: Matching MAC address for NAT networking...
==> default: Setting the name of the VM: Custom_default_1503826905856_10643
==> 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: 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: ubuntu
default: SSH auth method: password
==> default: Machine booted and ready!
==> default: Checking for guest additions in VM...
==> default: Configuring and enabling network interfaces...
==> default: Mounting shared folders...
default: /vagrant => /home/blackslate/repos/Vagrant/Custom
However, vagrant ssh
provokes the message at the beginning of this question. When I try to ssh in manually, using "ubuntu" as the ssh user and "vagrant" as the password, I get this:
ssh ubuntu@127.0.0.1
The authenticity of host '127.0.0.1 (127.0.0.1)' can't be established.
ECDSA key fingerprint is SHA256:PSnauymZfKi1HIRIKfez5wAnpPFJW9h3eC+TzxiiIWA.
Are you sure you want to continue connecting (yes/no)? y
Please type 'yes' or 'no': yes
Warning: Permanently added '127.0.0.1' (ECDSA) to the list of known hosts.
ubuntu@127.0.0.1's password:
Permission denied, please try again.
ubuntu@127.0.0.1's password:
I get a similar result if I try ssh vagrant@127.0.0.1
:
ssh vagrant@127.0.0.1
vagrant@127.0.0.1's password:
Permission denied, please try again.
vagrant@127.0.0.1's password:
The same is true if I open the VirtualBox GUI and talk to the VM directly.
I have tried following the instructions here, but I'm guessing that this refers to an older version of Vagrant.
I am hoping that I will be able to make changes at the package
stage, so that when I distribute the custom Vagrant box to other developers, vagrant ssh
just works, with no need to massage any files beforehand.