Vagrant's Ubuntu 16.04 vagrantfile default password

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP



Vagrant's Ubuntu 16.04 vagrantfile default password



I'm attempting to deploy and run an Ubuntu 16.04 VM via Vagrant 1.9.1.
The Vagrantfile I'm using is from Atlas:



Ubuntu Xenial 16.04 Vagrantfile



I'm using Debian Stretch as the host OS. Vagrant was installed via a .deb available from Vagrant's website.



The Vagrantfile does run and deploy correctly. I can ssh into the VM via both my host OS and using 'vagrant ssh'. However, I have one minor blocker when attempting to ssh in from outside.



The default user in this VM is named 'ubuntu', and looks to have a password set. However, I have no idea what the password is at all, and no docs seem to have the information that I'm looking for. Attempting to set a password via 'passwd' within the VM asks for a current password. Anyone see where this is going?



So my big question is this: has anyone else deployed this same Vagrantfile, and if so, does anyone know what the default user's password is?





It's worth mentioning that this breaks the vagrant standard of having the user/pass both default to 'vagrant'. vagrantup.com/docs/boxes/base.html
– Ryre
Dec 30 '16 at 6:42




5 Answers
5



As of writing this answer: no one ever publicly shared the password for user ubuntu on ubuntu/xenial64 Vagrant box (see #1569237).


ubuntu


ubuntu/xenial64



It's not necessary. You can:


sudo passwd ubuntu


ubuntu


NOPASSWD



Actually, not only you can, but you should change the password.





Thanks for linking to the Launchpad bug report! Following through the comments, I found a link to another Ubuntu 16.04 Vagrantfile which I downloaded and tested: atlas.hashicorp.com/bento/boxes/ubuntu-16.04 This one used the old username and password of "vagrant/vagrant", which allowed me to do my tests headache-free. :)
– rmenes379
Dec 27 '16 at 2:06



The password is located in the ~/.vagrant.d/ubuntu-VAGRANTSLASH-xenial64/20161221.0.0/virtualbox/Vagrantfile as mention by user @prometee in this launchpad discussion #1569237.


~/.vagrant.d/ubuntu-VAGRANTSLASH-xenial64/20161221.0.0/virtualbox/Vagrantfile



Here is mine (line 8):


# Front load the includes
include_vagrantfile = File.expand_path("../include/_Vagrantfile", __FILE__)
load include_vagrantfile if File.exist?(include_vagrantfile)

Vagrant.configure("2") do |config|
config.vm.base_mac = "022999D56C03"
config.ssh.username = "ubuntu"
config.ssh.password = "fbcd1ed4fe8c83b157dc6e0f"

config.vm.provider "virtualbox" do |vb|
vb.customize [ "modifyvm", :id, "--uart1", "0x3F8", "4" ]
vb.customize [ "modifyvm", :id, "--uartmode1", "file", File.join(Dir.pwd, "ubuntu-xenial-16.04-cloudimg-console.log") ]
end
end



FYI, user @racb mention in the same discusison that the this bug report having been filed to ubuntu and so far no [...] decision has been made yet about it.


this bug report having been filed


no [...] decision has been made yet





The path of the mentioned Vagrantfile has changed some (probably as a result of a more recent vagrant version). It now has /boxes in the path, like so: ~/.vagrant.d/boxes/ubuntu-VAGRANTSLASH-xenial64/20171028.0.0/virtualbox/Vagrantfile.
– Ville
Nov 1 '17 at 18:56


Vagrantfile


vagrant


/boxes


~/.vagrant.d/boxes/ubuntu-VAGRANTSLASH-xenial64/20171028.0.0/virtualbox/Vagrantfile



The new ubuntu/xenial64 image doesn't come with a default username and password. However you can ssh using an ssh-key generated in your vagrant folder.


ubuntu/xenial64



Let's say your Vagrantfile is at /vagrant/vm01/Vagrantfile, the ssh-key would be in /vagrant/vm01/.vagrant/machines/..../private_key


/vagrant/vm01/Vagrantfile


/vagrant/vm01/.vagrant/machines/..../private_key



You can login to your vagrant vm using this private_key. If the guest machine ask for the key's passphrase, just hit ENTER (specifying a blank passphrase). For example, on my Mac:


private_key


ENTER


ssh -i /vagrant/vm01/.vagrant/..../private_key <your vm user>@<your vm ip>:<your vm port>



If you still want to log in using username and password, after logging in using the private_key, you can add your own user for logging in later:


# create a user for log in
sudo useradd yourusername

# specify a password
sudo passwd yourusername
# then type your password when prompted

# add the user to sudo group
sudo adduser yourusername sudo

# create a home folder for your user
sudo mkdir /home/yourusername

# add a shell command for your user (normally /bin/bash)
sudo vim /etc/passwd
# find yourusername line, and add /bin/bash to the end.
# the end result would look like this:
yourusername:x:1020:1021::/home/yourusername:/bin/bash



Now you can ssh using the new username and password.



Not sure about the ubuntu 16.X password when you install through vagrant, but you can change that by your own by following below steps -


[~/from-vagrant-project]vagrant ssh
[ubuntu@hostname]sudo -i
root@hostname:~# passwd ubuntu
Enter new UNIX password:XXXXX
Retype new UNIX password:XXXXX
passwd: password updated successfully`



if this can help:



I solved the custom packaging issue by creating a normal VM (in my case ubuntu/xenial), then copying the Identify file found with vagrant ssh-config and using that file for config.sshprivate_key_path, plus also setting config.ssh.username to ubuntu.
(see also https://github.com/hashicorp/vagrant/issues/5186#issuecomment-355012068)


vagrant ssh-config


config.sshprivate_key_path


config.ssh.username


ubuntu






By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Popular posts from this blog

Firebase Auth - with Email and Password - Check user already registered

Dynamically update html content plain JS

How to determine optimal route across keyboard