I am creating an instance from command line using command
nova boot --no-service-net --no-public --disk-config AUTO --config-drive=true --flavor 2 --key-name key1 --image c28bc1e8-a25f-413c-9e13-fecdd5d6f522 test
when instance launched successfully I tried to ssh instance by using this command
ssh -i key1.key [email protected]
but it gives me an permission error,
Permission denied (publickey,gssapi-keyex,gssapi-with-mic)
And when I create an instance from Dashboard/Horizon. I can ssh without any problem or issue with the same command ssh -i key2.key [email protected]
Guide me what is the problem why I can't ssh after creating an instance from command line.
There was a problem in ssh key generation, I was generating ssh key like
ssh-keygen -t rsa -f newdemokey.key
and then add this key into nova keypair-list. That was not working to ssh instance
But the best way is to generate ssh key is,
ssh-keygen
And add this key into nova keypair-list,
nova keypair-add --pub-key ~/.ssh/id_rsa.pub test-key
It will work with the new instance to ssh.