Search code examples
sshvagrant

Permission denied with Vagrant


When I do a vagrant ssh in my project on a windows 10 laptop I get this error:

[email protected]: Permission denied (publickey).

When I then delete .vagrant/machines/default/virtualbox/private_key and do vagrant ssh again, I get access to the VM.

But when I then exit the VM and do `vagrant halt', I get this error:

==> default: Attempting graceful shutdown of VM... default: default: Vagrant insecure key detected. Vagrant will automatically replace default: this with a newly generated keypair for better security. default: default: Inserting generated public key within guest... translation missing: en.vagrant_ps.errors.powershell_error.powershell_error

It seems to me that it tries to add my SSH key, but something goed wrong. Any idea how I can solve this?


Solution

  • you can simply run following command in your cmd:

    set VAGRANT_PREFER_SYSTEM_BIN=0

    vagrant ssh

    successfully tested under the windows 10 with vagrant 2.1.5

    you can also see: https://www.vagrantup.com/docs/other/environmental-variables.html#vagrant_prefer_system_bin