Figured it out. The custom key that I am using should be appended to the default vagrant key - ~/.vagrant.d/insecure_private_key
So this config slave.ssh.private_key_path = ["keys/id_rsa_slave"] Should be changed to slave.ssh.private_key_path = ["keys/id_rsa_slave", "~/.vagrant.d/insecure_private_key"] After making this change, I ran > vagrant up And it came up successfully. On Saturday, May 16, 2020 at 10:07:43 PM UTC+5:30, Gokul wrote: > > *Below is my Vagrantfile* > > # -*- mode: ruby -*- > > # vi: set ft=ruby : > > > #Virtualbox host and vagrant host/network confs > > # > > Vagrant.configure("2") do |config| > > config.vm.define "slave" do |slave| > > slave.vm.box = "centos/7" > > slave.vm.hostname = "slave.ansible.com" > > slave.vm.network :private_network, ip: "192.168.99.102" > > slave.ssh.insert_key = false > > slave.vm.boot_timeout = 800 > > slave.ssh.private_key_path = ["keys/id_rsa_slave"] > > slave.vm.provision "file", source: "keys/id_rsa_slave.pub", > destination: "~/.ssh/authorized_keys" > > end > > > config.vm.provider "virtualbox" do |vb| > > vb.cpus = "1" > > vb.memory = "512" > > end > > > > *This Vagrantfile sits in the slave folder under my home directory > (/user/gokul/slave) and under this, I have keys directory with below keys > and appropriate permissions* > > > (base) Gokul:slave gokul$ ls -lt keys/ > > total 16 > > -rw------- 1 gokul gokul 565 May 16 18:30 id_rsa_slave.pub > > -rw------- 1 gokul gokul 2590 May 16 18:30 id_rsa_slave > > > > *Permission of the keys directory is also fine* > > (base) Gokul:slave gokul$ ls -ld keys/ > > drwx------ 4 gokul gokul 128 May 16 18:30 keys/ > > > > *Now I run below command to get my vagrant box up* > > > *vagrant up* > > > *And it hangs at this point failing to authenticate* > > ==> master: Waiting for machine to boot. This may take a few minutes... > > master: SSH address: 127.0.0.1:2200 > > master: SSH username: vagrant > > master: SSH auth method: private key > > master: Warning: Authentication failure. Retrying... > > master: Warning: Authentication failure. Retrying... > > > SSH authentication failed! This is typically caused by the public/private > > keypair for the SSH user not being properly set on the guest VM. Please > > verify that the guest VM is setup with the proper public key, and that > > the private key path for Vagrant is setup properly as well. > > > *With debug enabled also I can see that it picks up the private key that > I've asked to, however, it fails to authenticate successfully and fails > with above error. What am I missing?* > -- This mailing list is governed under the HashiCorp Community Guidelines - https://www.hashicorp.com/community-guidelines.html. Behavior in violation of those guidelines may result in your removal from this mailing list. GitHub Issues: https://github.com/hashicorp/vagrant/issues Discuss: https://discuss.hashicorp.com/c/vagrant/24 --- You received this message because you are subscribed to the Google Groups "Vagrant" group. To unsubscribe from this group and stop receiving emails from it, send an email to vagrant-up+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/vagrant-up/36741aca-89d8-41ea-b4b8-8cb63ab8dc1b%40googlegroups.com.