Vagrant box: can't login with password from VirtualBox GUI

MastroGeppetto picture MastroGeppetto · Oct 23, 2014 · Viewed 40.9k times · Source

I am learning to use Vagrant, and I tried to boot a Vagrant machine (an ubuntu/trusty64 built in the recommended way "vagrant init ubuntu/trusty64; vagrant up") from inside the VirtualBox GUI (double clicking the icon of the Vagrant machine). But I cannot login: no username, no password.

Do I need to add a specific provision, or there is another easier way to do this?

Thank you.

Answer

Oliver Bestwalter picture Oliver Bestwalter · Oct 23, 2014

UPDATE after clarification of question

You should be able to login as

user: vagrant
password: vagrant 

This is a convention described in the base box creation documentation:

Also, even though Vagrant uses key-based authentication by default, it is a general convention to set the password for the "vagrant" user to "vagrant". This lets people login as that user manually if they need to.

If you have a box where the password for the vagrant user is not set (or you just don't know it) you can do the following:

me@somebox$ vagrant ssh
vagrant@vagrant-ubuntu-trusty-64:~$ sudo passwd vagrant 
Enter new UNIX password: <type invisible new password here>
Retype new UNIX password: <re-type invisible new password here>
passwd: password updated successfully

Now you can login e.g. through the VirtualBox GUI.

Original answer (basically explaining that you should not have to do the above)

The basic idea is, that you do not have to use the Virtual machine providers tools for anything to work with vagrant. So as soon as you think you have to use the VirtualBox GUI you are doing something wrong.

Just try in terminal (or in cmd.exe if you are on windows):

me@somebox$ vagrant init ubuntu/trusty64
me@somebox$ vagrant up
me@somebox$ vagrant ssh
vagrant@vagrant-ubuntu-trusty-64:~$

If everything works you should be on the command line inside your new machine logged in as the user vagrant.