Search code examples
sshopenstackkey-pair

OpenStack: permission denied (publickey) when SSH'ing to the VMs


I am running devstack and I have created two instances with two different keypairs. This is my image:

+------------------+--------------------------------------+
| Property         | Value                                |
+------------------+--------------------------------------+
| checksum         | c1281b03b1b6375ccce5fc2913bc4bd1     |
| container_format | bare                                 |
| created_at       | 2016-02-20T16:14:11Z                 |
| disk_format      | qcow2                                |
| id               | 0ef7f4d5-8e9e-40e7-bc9e-89e1442af05c |
| min_disk         | 0                                    |
| min_ram          | 0                                    |
| name             | ubuntu                               |
| owner            | 2509b183165d4ed58d0ccad318dd6b4d     |
| protected        | False                                |
| size             | 287310336                            |
| status           | active                               |
| tags             | []                                   |
| updated_at       | 2016-02-20T16:14:33Z                 |
| virtual_size     | None                                 |
| visibility       | private                              |
+------------------+--------------------------------------+

But when I try to SSH into the VMs I get the permission denied (publickey) message. I was initially able to SSH but now I am not able to.

aditya@aditya-HP-Pavilion-Notebook:~/devstack$ ssh -i cloud1.key VM2@172.24.4.5
Permission denied (publickey).

I don't know what changed. Could you please help me debug this at the earliest? Thanks!


Solution

  • Are you sure that the username you should connect with is 'VM2', as your command indicates? Your image name is 'ubuntu', the username is usually 'ubuntu'. Try with that.

    Have you changed your instance to allow access from a different user?