changing default vagrant user

1,159 views
Skip to first unread message

Michael Legleux

unread,
May 28, 2015, 9:38:32 PM5/28/15
to vagra...@googlegroups.com
I'm creating a base box of windows and would like to NOT have user/pass vagrant/vagrant.

The wording in the documentation is not very clear on how to accomplish something like this.

  • The MAC address of the first network interface (the NAT adapter) should be noted, since you'll need to put it in a Vagrantfile later as the value for config.vm.base_mac. To get this value, use the VirtualBox GUI.

But then at the bottom of the page it's stated that:
If you're not using vagrant package --base above, you'll have to set theconfig.vm.base_mac setting in this Vagrantfile to the MAC address of the NAT device without colons.
I have always used  vagrant package --base alone and seemingly have never had a problem (with communication at least.)
So what i want is to set config.ssh.username to be NOT vagrant by default.
From what I gather i should vagrant package --base <the_vb_name> --vagrantfile <somevagrantfile> where vagrantfile has the username/password configuration in it. ALSO if I do that, I will have to manually set the MAC address in there?
Thanks, hope that was intelligible! 

dragon788

unread,
May 29, 2015, 11:34:47 AM5/29/15
to vagra...@googlegroups.com
Are you building your own box or trying to reuse and change the name in an existing box? If you are packaging a box, you need to create the user within Windows yourself with whatever password you desire, then package that VM into a box. Its easiest to do this using Packer, as it has plugins for managing Windows, but your best bet is to find someone who has done it already and change the username/password etc to suit.

Michael Legleux

unread,
May 29, 2015, 2:03:46 PM5/29/15
to vagra...@googlegroups.com
Yeah I am packaging the box from scratch as I have done several times before with success, but I want vagrant to be able to log in as a different user WITHOUT additional modification in a vagrantfile.
I want the box to be already packaged and ready to use a different username/password.
This must be possible?

Michael Legleux

unread,
May 29, 2015, 9:27:33 PM5/29/15
to vagra...@googlegroups.com
So once again, I assumed the command:
vagrant package --base <thevbox> --vagrantfile <vagrantfile_in_this_directory> would put that vagrantfile into the package.box after it was done.
I just ran that command, decompressed the box file and lo and behold the vagrantfile in the package.box does NOT contain anything that was in the vagrantfile included via --vagrantfile <thevagrantfile>, only the config.vm_base_mac line.

What gives!?! 


On Thursday, May 28, 2015 at 6:38:32 PM UTC-7, Michael Legleux wrote:

Ethan S.

unread,
May 29, 2015, 11:15:00 PM5/29/15
to vagra...@googlegroups.com

I'm not sure what the intended behavior is in that scenario, but I do know if you use the Packer tool it allows you to define a vagrantfile that goes into the box.

--
You received this message because you are subscribed to a topic in the Google Groups "Vagrant" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/vagrant-up/4pwSmFAude8/unsubscribe.
To unsubscribe from this group and all its topics, send an email to vagrant-up+...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages