how to use ssh to visit vm in openstack environment – A server stack is the collection of software that forms the operational infrastructure on a given machine. In a computing context, a stack is an ordered pile. A server stack is one type of solution stack — an ordered selection of software that makes it possible to complete a particular task. Like in this post about how to use ssh to visit vm in openstack environment was one problem in server stack that need for a solution. Below are some tips in manage your linux server when you find problem about linux, cloud, openstack, , .
What I want to do: use python script to login the vm in openstack
What I did so far: I used CLI:
openstack keypair create to create openstack keypair and use
abc > /root/keydir/abc
chmod 600 abc to change the permission
Then I create a vm from dashboard and use the key which I created just now
I set up the vm and wait it to the right state At last I use this command in controller node: ip netns exec qdhcp-c8db7805-c5e8-aaaa-xxxx-xxxxx ssh -i /root/keydir/abc email@example.com(vm’s ip) “ping 127.0.0.1 -c 10
When I run this in python, it shows me:
Permission denied (publickey,gssapi-keyex,gssapi-with-mic,password). I run the command in Linux directly it prompt me to input password, and this not the result I want
Why doesn’t the keypair work?
This is a common problem I faced. When you generate the keys on the server side, you must export the RSA private/public key to the machine which you’d like to connect from. The public key (that’s also in authorized keys) is the only one you’ll need.
I use PuTTy to do this, because you can generate a .ppk file with the RSA key from Notepad. You just need to cat the file with they Key ——BEGIN RSA KEY——- and put it into a Notepad, then PuTTy Key Generator to make to .ppk.
Here is a great guide: https://support.rackspace.com/how-to/log-into-a-linux-server-with-an-ssh-private-key-on-windows/