Reputation: 1029
I am trying to ssh as ubuntu user on ubuntu/bionic64 box version 20181024.0.0, using this Vagrant file:
# -*- mode: ruby -*-
# vi: set ft=ruby :
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.box = "ubuntu/bionic64"
config.vm.box_version = "20181024.0.0"
config.vm.network :private_network, ip: "192.168.24.25"
config.vm.provider :virtualbox do |vb|
vb.customize ["modifyvm", :id, "--memory", "256"]
end
end
When doing vagrant up
and vagrant ssh
, I am logged in as vagrant user. If this line is added:
config.ssh.username = 'ubuntu'
to get a Vagrantfile like this:
# -*- mode: ruby -*-
# vi: set ft=ruby :
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.box = "ubuntu/bionic64"
config.vm.box_version = "20181024.0.0"
config.vm.network :private_network, ip: "192.168.24.25"
config.ssh.username = "ubuntu"
config.vm.provider :virtualbox do |vb|
vb.customize ["modifyvm", :id, "--memory", "256"]
end
end
and running vagrant up
, I'm getting the authentication error message:
default: Warning: Authentication failure. Retrying...
I have also tried adding this line
config.ssh.insert_key = 'true'
But that doesn't work either.
I am aware that the user can be changed once ssh'd into the vm as vagrant
user, but I'd like that to be done automatically, as is the case when using ubuntu/xenial64 version 20171011.0.0 with default configuration.
Any ideas how to workaround this?
Vagrant version: 2.2.0
VirtualBox version: 5.2.20 r125813
The whole output is:
danilo$ vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Importing base box 'ubuntu/bionic64'...
==> default: Matching MAC address for NAT networking...
==> default: Checking if box 'ubuntu/bionic64' is up to date...
==> default: Setting the name of the VM: ubuntu-bionic64_default_1540543288462_93774
==> 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: private key
default: Warning: Connection reset. Retrying...
default: Warning: Remote connection disconnect. Retrying...
default: Warning: Authentication failure. Retrying...
default: Warning: Authentication failure. Retrying...
default: Warning: Authentication failure. Retrying...
default: Warning: Authentication failure. Retrying...
default: Warning: Authentication failure. Retrying...
default: Warning: Authentication failure. Retrying...
default: Warning: Authentication failure. Retrying...
Upvotes: 0
Views: 3171
Reputation: 642
instruction based on https://openedx.atlassian.net/wiki/spaces/OXA/pages/157802739/Vagrant+is+stuck+Authentication+failure.+Retrying...
in short
config.ssh.username = "ubuntu"
in Vagrantfilevagrant up
\\ setup VM with default vagrant userIdentityFile
path value from result of command vagrant ssh-config
ssh-keygen -y -f <!!path-from-IdentityFile!!>
, copy this keyvagrant ssh
\\ you will auth under vagrant user for a whilesudo -u ubuntu bash
\\ change uservim ~/.ssh/authorized_keys
, add key from 4.config.ssh.username = "ubuntu"
in Vagrantfilevagrant reload
vagrant ssh
\\ you will auth under ubuntu user nowUpvotes: 3