Ask Your Question

Ubuntu image in openstack [closed]

asked 2017-05-09 06:17:30 -0500

sanjana gravatar image

updated 2017-05-09 23:36:13 -0500

I have an ubuntu image that i wish to upload to glance. i downloaded the image and uploaded it.

openstack image create --disk-format qcow2 --container-format bare --public --file ./xenial-server-cloudimg-amd64-disk1.img

The details for the image is as below: sanjana@sanjana-ProLiant-DL120-G7:~$ openstack image show ubuntu +------------------+------------------------------------------------------+ | Field | Value | +------------------+------------------------------------------------------+ | checksum | f803093406007766e86f4e9185cd652b | | container_format | bare | | created_at | 2017-05-09T10:12:10Z | | disk_format | qcow2 | | file | /v2/images/119e4fc1-75e2-46e3-8251-9ce3f19ab908/file | | id | 119e4fc1-75e2-46e3-8251-9ce3f19ab908 | | min_disk | 0 | | min_ram | 0 | | name | ubuntu | | owner | 07b11f80bfb24a7e9993e93b634c298c | | protected | False | | schema | /v2/schemas/image | | size | 287047680 | | status | active | | tags | | | updated_at | 2017-05-09T10:12:11Z | | virtual_size | None | | visibility | public | +------------------+------------------------------------------------------+

I launched an instance using this image through horizon.However when i log into console it prompts for both user and password. What is the default value? i read a few posts that asked me to associate key with it. I have tried to import key and use it, also tried to use .pem file to ssh into the vm from out but both give me the same issue. It prompts for login and password. ssh -i xxx.pem ubuntu@10.x.x.x gives connection refused error

edit retag flag offensive reopen merge delete

Closed for the following reason the question is answered, right answer was accepted by sanjana
close date 2017-05-10 04:15:09.692178

2 answers

Sort by ยป oldest newest most voted

answered 2017-05-09 11:22:33 -0500

updated 2017-05-09 11:23:48 -0500

Hi @sanjana, cloud images look for SSH keys through the metadata service. So you need to create a key pair (can do this through horizon) and then use it to login into the VM through SSH (ssh -i xxx.pem ubuntu@...) ...if you create more than one key, when you launch the instance, you can select between them for the specific instance. You can't access through console through this method, and as far as I know there are no default credentials defined or published for ubuntu cloud images. Please add more details for the problems you have when creating the key through horizon.

edit flag offensive delete link more


Hi @gianpietro. I tried creating a key in Horizon. ssh-keygen -t rsa -f cloud.key and then pasted the contents and imported it. I even associated it with the VM and tried logging into it through the vnc console through horizon. However it still promts for both login and password.

sanjana gravatar imagesanjana ( 2017-05-09 22:54:12 -0500 )edit

I also tried to directly create a key pair through Horizon. It downloads a .pem file. I tried to use this .pem file and ssh into instance as you mentioned, but i get the below error: ssh -i test.pem ubuntu@10.x.x.x ssh: connect to host 10.x.x.x port 22: Connection refused

sanjana gravatar imagesanjana ( 2017-05-09 23:32:52 -0500 )edit

Let's detail the two methods you attempted: (1) Horizon - After pem file is created, make sure the key is associated to the instance at launch. Also make sure the pem's file permissions are set to 600 (i.e. chmod 600 test.pem) (continues...)

gianpietro gravatar imagegianpietro ( 2017-05-09 23:55:25 -0500 )edit

(2) Through CLI - a safe way is, after you created the key with keygen, run "openstack keypair create --public-key [public-key-location] myRSAKey ... then you make sure this key is associated at instance launch, and you will be able to SSH directly from the host where you created the key.

gianpietro gravatar imagegianpietro ( 2017-05-09 23:58:52 -0500 )edit

Thanks for the reply @gianpietro. I re-tried method (1). I ensured that my test.pem file has a permission of rw- --- --- (600). Howver it gives me Permission denied (publickey). error

sanjana gravatar imagesanjana ( 2017-05-10 00:46:58 -0500 )edit

answered 2017-05-10 04:14:40 -0500

sanjana gravatar image

Just a quick summary of the solution mentioned by @gianpietro.


  1. Create a key-pair in horizon. It will automatically download a .pem file
  2. Change the permission of this .pem file to 600 (i.e chmod 600 xxx.pem)
  3. ssh -i xxx.pem ubuntu@10.x.x.x

    and you can log into the machine

edit flag offensive delete link more

Get to know Ask OpenStack

Resources for moderators

Question Tools

1 follower


Asked: 2017-05-09 06:17:30 -0500

Seen: 1,220 times

Last updated: May 10 '17