Vagrant : Permission denied (publickey) Vagrant : Permission denied (publickey) linux linux

Vagrant : Permission denied (publickey)


Use the private key in your connection with the vagrant box

ssh -i .vagrant/machines/default/virtualbox/private_key vagrant@192.168.33.71


config.vm.synced_folder '.' and '/home/vagrant/' caused this problem.Because the configure makes home directory on the host overwritten and destroy .ssh settings on the host.I got the same problem a few seconds ago. I checked the .ssh was overwritten by Vagrant GUI.

In the summary, your synced folder overrides the .ssh folder in the virtual machine, so you cannot login with ssh.

The answer is from this issue.


Please brief your question , from where to where you are SSHing. If you are SSHing through Vagrant box.. then you always have to use vagrant before any command.In case of vagrant only ssh ubuntu@192.168.33.71 will not work.

vagrant ssh user@vmmachine

If you are using other user than default vagrant user you have to copy your Host machine public key content into guest machine user's authorized_keys file.(Use only if you are SSHing using vagrant to guest machine)

default location for authorized_keys:

/home/ubuntu/.ssh/authorized_keys