Vagrant's Ubuntu 16.04 vagrantfile default password - linux

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?

As of writing this answer: no one ever publicly shared the password for user ubuntu on ubuntu/xenial64 Vagrant box (see #1569237).
It's not necessary. You can:
login using SSH key authentication
change the password using sudo passwd ubuntu (by default ubuntu user has sudo-permissions with NOPASSWD set)
Actually, not only you can, but you should change the password.

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.
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.

The default user and password is:
user: vagrant
password: vagrant

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.
Let's say your Vagrantfile is at /vagrant/vm01/Vagrantfile, the ssh-key would be in /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:
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)

Related

Google Compute Engine instance requires password for sudo - what is my password?

I have a new google compute engine instance. I am SSH'ed into the instance using certs. Whenever I try to use sudo it asks for the primary user's password which I do not have. Just recently I setup an instance on centos 7 and did not have this issue.
The instance is running centos 8. Normally, I would ssh to the instance, then execute commands using Sudo. For example, I would like to set the root password.
if I run sudo passwd, sudo su - or even sudo cat /var/log/messages it asks me for the primary user's password. The problem is I do not have that password.
[primaryuser#server4 log]$ **sudo cat messages**
**[sudo] password for primaryuser:**
##########
[primaryuser#server4 log]$ **sudo passwd**
**[sudo] password for primaryuser:**
I expected to run the commands using sudo but do not have the password.
Does anyone have any ideas? I read other posts about similar problems but different from mine.
I had to give up and use ubuntu. Everything acted as expected on ubuntu and I was able to set the password. I believe the problem is limited to centos 8 but I am not certain.

aws ec2 ubuntu require my password

i want to build a project and failed because it requires root permission. When i change the user to root as "sudo -s", it prompted [sudo] password for ubuntu. As ec2 doesn't offer ubuntu password, it login with pem file. How can I login as root and create files? Thanks!
I fixed this by doing using "sudo" for a Ubuntu AWS EC2 SSH Login:
$ sudo passwd ubuntu
Instead of prompting me for:
"(current) UNIX password:"
It prompts now for:
"Enter new UNIX password:"
I hope this fixes some problems with ec2 ubuntu users!
I was surprised as well, when AWS ec2 ubuntu prompted me for a password.
[sudo] password for ubuntu:
In the end I just hit return without inserting anything and it worked.
If you want to run commands from your terminal interactively as root do it as follows:
sudo -i
If just want to run a single command do it as:
sudo some-command-goes-here
You will not be prompted for password in any of these scenario.
AWS doesn't grant root access by default to EC2 instances. This is an important security best practise. Users are supposed to open a ssh connection using the secure key/pair to login as ec2-user. Users are supposed to use the sudo command as ec2-user to obtain elevated privileges.

unable to connect to Ubuntu ami without using KeyPair

I have build an AMI in aws using
Ubuntu Server 16.04 LTS (HVM), SSD Volume Type - ami-0d77397e
Now I might be mis-understanding this, but I don't want to use a keypair as we are sharing this ami around a team. It is in a security group that is locked down to our IP's, so i just want to be able to log in using user/pass
When I try to connect I get the username prompt which I enter the user name Ubuntu in on pressing enter I get this prompt:
Disconnected: No supported authentication methods available (server sent: publickey)
Instead of sharing keys you can create unix users like
1) sudo adduser username -- It will ask you enter password and other details
2) Edit /etc/ssh/sshd_config setting
PasswordAuthentication yes
3) Restart the ssh daemon with
sudo service ssh restart
Now log back in by saying ssh username#ec2_ip and enter the password you just created in 1.
You should use key pairs (multiple, no need to share them), but if you really are resistant then you can enable password logins.

How do I set my user password on my Google Cloud Ubuntu instance?

I have started an Ubuntu 15.10 instance on Google Cloud and installed Webmin as per here:
http://www.webmin.com/deb.html
Webmin has been installed successfully and I can see the login page in my browser window, however I need to type my username along with my password with sudo level access to login and start using Webmin.
I've used the SSH via the browser window so have never set a password for any sort of access to the root.
Does anyone know how to set a password for myself to login as a sudo user on my instance?
Okay, I figured it out. I was looking at the permissions menu in Google Cloud, but it was as simple as changing the root password in Linux by typing: sudo passwd
it's working for me
vfa_gianglt#instance-1:~$ sudo -i
root#instance-1:~# sudo bash
root#instance-1:~# sudo passwd root
Enter new UNIX password:
Retype new UNIX password:
passwd: password updated successfully
root#instance-1:~# cd /root
root#instance-1:~#

putty connect successfully, while pscp run into "server refused our key"

I create one SUSE linux EC2 instance in Amazon AWS.
And it is OK to 'putty' to access the instance (use the key-pair file, let's call it key.pem, I have converted it to key.ppk), and when log in the host, I am using 'root' user name, and it is OK.
login as: root
Authenticating with public key "imported-openssh-key"
Last login: Tue Apr 15 15:17:55 2014 from x.x.x.x
SUSE Linux Enterprise Server 11 SP3 x86_64 (64-bit)
As "root" use the:
- zypper command for package management
- yast command for configuration management
Management and Config: https://www.suse.com/suse-in-the-cloud-basics
Documentation: http://www.suse.com/documentation/sles11/
Have a lot of fun...
While when I try to use 'pscp' to copy files, it always failed, and outputs
Server refused our key
Using Keyboard-interactive authentication.
Password:
My 'pscp' command usage as following
C:\Users\t440s\Downloads\putty\pscp.exe -i key.pps test.txt root#myhost.compute.amazonaws.com:/tmp
Actually, I do not know my password.
And I checked following section of /etc/ssh/sshd_config, seems root do not need password
# Authentication:
#LoginGraceTime 2m
PermitRootLogin without-password
PasswordAuthentication no
I am using win8.
Please help me. Yours.
I would like you should use Git Bash tool http://git-scm.com/download/win its free and opensource, Please download and install , You have Unix environment is windows :)
now in the git bash type command ls to check where you are and now you can type this command in GIT bash
scp -i /c/Users/USERNAME/Download/key.pem filename.txt ec2-user#ec2-81.1821.1..eu-west-1.compute.amazonaws.com:/tmp
You can replace the user ec2-user to ubuntu or any other which is associate to that machine I dont think root work. Let me know is that works for you

Resources