Changing Vagrantfile causes “vagrant ssh” to prompt for a password?

前端 未结 1 1587
天命终不由人
天命终不由人 2020-12-15 06:01

I\'ve been playing around with setting up an environment using Vagrant, and I\'m having an issue with the vagrant ssh command.

When I change the path of

相关标签:
1条回答
  • 2020-12-15 06:44

    Take note of what is actually happening here. When you share the /home/vagrant folder the VM Provider (most likely VirtualBox) has control of that folder and the permissions get all mangled by VirtualBox. You won't be able to set the 0700 perms for the .ssh folder nor will you be able to set the 0600 perms for the authorized_keys file inside the .ssh folder. Consequently, the vagrant ssh command will explicitly ask you for the password since it can't check the public key in the .ssh folder.

    Makio was right about /vagrant being the default share folder. You can share pretty much any folder you want except for the /home/vagrant folder. I know about this personally because I ran into the very same issue you did. By allowing Vagrant to control the /home/vagrant folder, the permissions get set appropriately for vagrant ssh to function properly.

    Glad it's resolved and I hope I shed a bit more light on exactly why this gives people a problem.

    c0p

    0 讨论(0)
提交回复
热议问题