Ask Your Question
0

can't ssh an instance

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

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
1

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

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

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

Comments

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

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

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 -0600 )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 -0600 )edit

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

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

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

novainfinite gravatar image

you should inject password to ubuntu and then launch it

edit flag offensive delete link more

Comments

@novainfinite how can i do this ?

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

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Get to know Ask OpenStack

Resources for moderators

Question Tools

1 follower

Stats

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

Seen: 40 times

Last updated: Dec 11 '18