Ask Your Question

can't ssh an instance

asked 2018-12-11 06:17:39 -0500

najeh gravatar image

i use a ubuntu 18.04 image to launch the instance, but after the launching i cannot ssh this instance and an error is displyed

ssh ubuntu@192.168.x.x

ubuntu@192.168.x.x: Permission denied (publickey).

what can i do ?

edit retag flag offensive close merge delete

2 answers

Sort by ยป oldest newest most voted

answered 2018-12-11 08:04:19 -0500

updated 2018-12-11 08:04:43 -0500

Best practice is to not have passwords on cloud instances. If you have several hundred instances to look after, you either give them the same password (bad for security) or you have to remember several hundred passwords (good luck).

So, the standard practice is to use password-less ssh. You set up a keypair (openstack keypair create mykey > mykey.pem), launch the instance with the key (openstack server create --key-name mykey ...), and ssh into the instance using the private key (ssh -i mykey.pem ...).

i suggest you learn about ssh and keys, and Nova and keypairs.

edit flag offensive delete link more


Thanks this solve my issue, the mykey.pem will be the same for all instances ?

najeh gravatar imagenajeh ( 2018-12-11 08:25:51 -0500 )edit

For all instances that you launch with mykey. But if you like you can create other keypairs and run instances with those.

Bernd Bausch gravatar imageBernd Bausch ( 2018-12-11 08:32:30 -0500 )edit

I acces to the instance and after a few time i lose this access and i can't ping the instance address. Where is the problem ?

and show this error

ssh: connect to host 192.168.x.x port 22: Connection refused

najeh gravatar imagenajeh ( 2018-12-11 09:17:19 -0500 )edit

I would suspect some other device has the same IP address.

Bernd Bausch gravatar imageBernd Bausch ( 2018-12-11 16:52:35 -0500 )edit

answered 2018-12-11 07:38:35 -0500

yasin lachiny gravatar image

you should inject password to ubuntu and then launch it

edit flag offensive delete link more


@novainfinite how can i do this ?

najeh gravatar imagenajeh ( 2018-12-11 07:43:34 -0500 )edit

Get to know Ask OpenStack

Resources for moderators

Question Tools

1 follower


Asked: 2018-12-11 06:17:39 -0500

Seen: 612 times

Last updated: Dec 11 '18