The problem with ssh authentication:
==> default: Clearing any previously set forwarded ports...
==> default: Clearing any previously set network interfaces...
==> default: Preparing network interfaces based on configuration...
default: Adapter 1: nat
default: Adapter 2: bridged
==> default: Forwarding ports...
default: 22 => 2222 (adapter 1)
==> 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: private key
default: Error: Connection timeout. Retrying...
default: Error: Connection timeout. Retrying...
default: Error: Connection timeout. Retrying...
default: Error: Connection timeout. Retrying...
default: Error: Authentication failure. Retrying...
default: Error: Authentication failure. Retrying...
default: Error: Authentication failure. Retrying...
default: Error: Authentication failure. Retrying...
default: Error: Authentication failure. Retrying...
I can Ctrl+C
out of the authentication loop and then successfully ssh in manually.
I performed the following steps on the guest box:
Enabled
Remote Login
forAll Users
.Created the
~/.ssh
directory with0700
permissions.Created the
~/.ssh/authorized_keys
file with0600
permissions.Pasted this public key into
~/.ssh/authorized_keys
I've also tried using a private (hostonly) network instead of the public (bridged) network, using this line in the Vagrantfile:
config.vm.network "private_network", ip: "172.16.177.7"
I get the same output (except Adapter 2: hostonly
) but then cannot ssh in manually.
I also tried config.vm.network "private_network", ip: "10.0.0.100"
.
I also tried setting config.ssh.password
in the Vagrantfile. This does output SSH auth method: password
but still doesn't authenticate.
And I also tried rebuilding the box and rechecking all the above.
It looks like others have had success with this configuration, so there must be something I'm doing wrong.
I found this thread and enabled the GUI, but that doesn't help.
This the all correct steps that I followed for fix this bellow issue occurred when vagrant up command run.
These are the steps that I followed
************************THIS IS WORK FINE FOR ME*******************************
Problem I was getting the ssh authentication errors, on a box I provisioned. The original was working ok.
The problem for me was I was missing a private key in
.vagrant/machines/default/virtualbox/private_key
. I copied the private key from the same relative location from the original box and Viola!Simple:
Edit (Not as simple as first thought):
The issue was that new versions of homestead use
php7.0
and some other stuff. To avoid this mess up make sure you set theverison
inHomestead.yml
:If you are using default SSH setup in your VagrantFile and started seeing SSH authentication errors after re-associating your VM box due to crash, try replacing public key in your vagrant machine.
Vagrant replaces public key associated with insecure private key pair at each log out due to security reasons. If you didn't properly shut down your machine, public/private key pair can go out of sync, causing SSH authentication error.
To resolve this issue, simply load up the current insecure private key and then copy the public key pair into your VM's authorized_keys file.
For general information: by default to ssh-connect you may simply use
user:
vagrant
password:vagrant
https://www.vagrantup.com/docs/boxes/base.html#quot-vagrant-quot-user
First, try: to see what vagrant
insecure_private_key
is in your machine configExample:
http://docs.vagrantup.com/v2/cli/ssh_config.html
Second, do: Change the contents of file
insecure_private_key
with the contents of your personal system private keyOr use: Add it to the Vagrantfile:
config.ssh.private_key_path
is your local private keyssh-add -L
. If it's not listed, add it withssh-add ~/.ssh/id_rsa
~/.ssh/authorized_keys
on the Vagrant VM. You can do it by copy-and-pasting or using a tool like ssh-copy-id (user:root
password:vagrant
port: 2222)ssh-copy-id '-p 2222 root@127.0.0.1'
If still does not work try this:
Remove
insecure_private_key
file fromc:\Users\USERNAME\.vagrant.d\insecure_private_key
Run
vagrant up
(vagrant will be generate a newinsecure_private_key
file)In other cases, it is helpful to just set forward_agent in
Vagrantfile
:Useful:
Configurating git may be with git-scm.com
After setup this program and creating personal system private key will be in yours profile path:
c:\users\USERNAME\.ssh\id_rsa.pub
PS: Finally - suggest you look at Ubuntu on Windows 10
Run the following commands in guest machine/VM:
Then do vagrant halt. This will remove and regenerate your private keys.
(These steps assume you have already created or already have the ~/.ssh/ and ~/.ssh/authorized_keys directories under your home folder.)