1

I have been following this doc on Vagrant.

I installed VirtualBox and Vagrant, then created a folder and ran vagrant init and vagrant up. When I typed vagrant ssh I got this message:

The private key to connect to the machine via SSH must be owned
by the user running Vagrant. This is a strict requirement from
SSH itself. Please fix the following key to be owned by the user
running Vagrant:

/media/***/Vagrant/.vagrant/machines/default/virtualbox/private_key

I have read some article related to this problem. I think I have to add the key to my system or something about verifying the key. But I am not clear about the most solutions. Anyway, it would be nice if someone could give me a solution for this.

Also when I try to access my virtual running os from VirtualBox UI it ask for username and password. But while I was setting up vagrant and VirtualBox I did not insert any username or password. So I don't know why it is asking for username and password.

  • yes I have hidden my username. but my username is 'shahin' and above command give results 'drwxrwxrwx 1 root root 4096 Mar 11 12:03 . ' – user1670773 Mar 11 '16 at 11:11
  • 1
    ok, and what is the result of ls -l /media/shahin/Vagrant/.vagrant/machines/default/virtualbox/private_key? – techraf Mar 11 '16 at 11:15
  • 1
    What exactly is /media? Isn't it a mountpoint for an external disk. What filesystem do you use on that disk? – techraf Mar 11 '16 at 11:29
0

If you are trying to mount the vagrant box off of NTFS, it is not possible to change the owner of the key file.

If you want to mount the file on NTFS and you are running a local instance you can try the following which worked for me:

Vagrant Halt

[remove the vagrant box]

[Add the following line to Vagrantfile] config.ssh.insert_key=false

[** you may need to remove and clone your project again]

Vagrant Provision

This solution may not be suitable for a live instance - it uses the default insecure ssh key. If you require more security you might be able to find a more palatable soultion here https://www.vagrantup.com/docs/vagrantfile/ssh_settings.html

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.