Ubuntu Cloud server image input credentials

I am trying to create a cloud infrastructure using VM

The Openstack manuals mention that the images in this link contain Openstack pre-installed.

I downloaded the trusty-server-cloudimg-amd64-disk1.img and I downloaded it using KVM. I created a virtual machine instance using this image, but I cannot log in (using the console) or ssh into it.

I do not know the default username and password for this OS.

Also (another question), I would like to create a Cloud using two virtual machines, is it possible to use the same image?

+19
virtual-machine ubuntu cloud openstack
source share
6 answers

18.04 step-by-step setup

In short, you need to on the host:

 sudo apt-get install cloud-image-utils cat >user-data <<EOF #cloud-config password: asdfqwer chpasswd: { expire: False } ssh_pwauth: True EOF cloud-localds user-data.img user-data # user-data.img MUST come after the rootfs. qemu-system-x86_64 \ -drive file=ubuntu-18.04-server-cloudimg-amd64.img,format=qcow2 \ -drive file=user-data.img,format=raw \ -m 1G ... 

and now you can log in via:

  • username: ubuntu
  • password: asdfqwer

Here I will describe the complete minimum detailed working QEMU example: https://askubuntu.com/questions/281763/is-there-any-prebuilt-qemu-ubuntu-image32bit-online/1081171#1081171

Tested on Ubuntu 18.04 host.

+5
source share

How about this:

 $ virt-customize -a bionic-server-cloudimg-amd64.img --root-password password:coolpass 
+5
source share

The default username for the ubuntu ubuntu image.
There is no default password, and you cannot use ssh on the machine using the username / password or connect through the VNC console. You must use the public / private key authentication method with ssh. Also sudo height for ubuntu account without password.

After the first access to the virtual machine, you can change these settings and enable username / password authentication for ssh.

Regarding your second question,
Yes, you can use the same image for multiple virtual machines.

+4
source share

Here are a few details on how to first enter a new instance of Ubuntu to complement @Athafoud's answer.

In the OpenStack GUI, you manage your public / private keys in Project> Compute> Access & Security. Create an SSH key (for example, using ssh-keygen under Linux or macOS) and add it to the OpenStack keys by clicking "Import Key Pair". (Or you can "Create a key pair" from the OpenStack GUI and then export the keys to your workstation.)

When you create a new instance (VM), you must specify this key as the "key pair" that you will use for the first login.

When your new instance is up and running, connect to it via SSH as follows:

ssh -i <keyfile> ubuntu@ <instance>

where <keyfile> is the name of the SSH key associated with the instance, and <instance> is the host name or IP address of the instance. This command registers you with an ubuntu account on the instance without asking for a password.

The ubuntu user has sudo privileges, so you can log in as root by typing sudo -i after logging in and manage virtual sudo -i :-).

0
source share

The following code can be used to make Ubuntu cloudimg for use on a Debian 7.2 (wheezy) machine:

 apt-get install pwgen apt-get install genisoimage git clone -b master https://git.launchpad.net/cloud-utils printf "#cloud-config\n" > user-data printf "password: 'pwgen 8 1'\nchpasswd: { expire: False }\nssh_pwauth: True\n" >> user-data ./cloud-utils/bin/cloud-localds user-data.img user-data 

Afterwards, you should run an image like this from the tmux window to make sure that it continues to work even if you log out:

kvm -m 2048 -smp 2 -hda ubuntu-18.10-server-cloudimg-amd64.img -hdb user-data.img -net nic -net user,hostfwd=tcp::1810-:22 -nographic

You can then log in as the ubuntu user and the password generated in user-data . Login can be either through a serial console printed by kvm (which will usually be quite slow even if you have an ssh connection on top of it) or through ssh with ssh ubuntu@localhost -p1810 . The ubuntu user, by default, accesses the sudo password as the root user.


PS I also tried to play with the addition of ssh-authorized-keys , but the cloud-config format seems very fragile and at the top level it is simply ignored, while at the user users: level users: as shown below, the whole ubuntu user seems to break (at least least part of the password). Here is the code to get the keys in a format that is potentially legible for the cloud configuration:

 printf "users:\n - name: ubuntu\n ssh-authorized-keys:\n" >> user-data cat ~/.ssh/id_rsa.pub ~/.ssh/authorized_keys | sed 's/^/ - /g' >> user-data 

(Note that password , apparently, may be an invalid field for the users specification, since instead it has a passwd hash code, so all this violates the previous code, because now user Ubuntu is created without a password.)

0
source share

Mounting the image and then using chpasswd inside chroot was the easiest solution for me:

 modprobe nbd max_part=8 && qemu-nbd -c /dev/nbd0 image.raw && mkdir a && mount /dev/nbd0p1 a chroot a sh -c "echo 'root:password' | chpasswd" umount ./a && rmdir a && qemu-nbd -d /dev/nbd0 
0
source share

All Articles