What I did (without success):
Imported the Debian 8.2 KVM using Marketplace in Sunstone.
Added into the template my public key of three different users:
First, my local user of my client. After that, I added the public key of a user root. This also does not work so I added the public key of oneadmin (see link above).
Starting the virtual machine I am unable to ssh and also unable to login without passwort using vnc (and unable to login using ssh).
In the documentation I am only to find “provide the public key”, but what public key I have to use? Do I have to add in the template into the context field?
Tried other images of the marketplace, but the same problem.
Using VNC, the machine wants to have a username and password.
Which public rsa key of what user I have to paste where?
There are various places where you can add your public key:
in your sunstone user’s settings:
Settings --> Info tabb --> ‘Public SSH key’ box
in you VM template:
Selecet VM template -> Update --> Context tab --> Public Key (Add ssh contextualization must be ticked)
For SSH to work you must enable the networking by selecting a network in the network tab in the template wizard after you import image from the marketplace.
To set a password for the VM from the market place some more preparation is needed. For example to set the root password on VM instantiation:
Create the following text file:
#!/bin/sh
if [ -n "$ROOT_PASSWORD" ]; then
echo "root:$ROOT_PASSWORD" | chpasswd
fi
Then upload it in the Files & Kernels. Set its name to like set-root-password.sh
Then in the VM template -> Context --> Configuration add User input with the following attributes:
Name: ROOT_PASSWORD
Type: password
Description: any description (optional?)
Then select Files (next under Configuration) and select the imported script.
In the Init scripts field type the file’s name - same as the one you set in Files & Kernels.
With the above configuration in the VM instantiation dialog There will be prompt to set the password for root. (Somewhere on the bottom of the page)
Type an password, start the VM and use it to login in the VNC console.
thank you very much for your detailed description.
Both ways are working now (it was the public ssh key of my user I am working within sunstone, wich let me login now using ssh). It also works like a charm by providing the password script.
I decided to use the “password method”, because all my other virtual machines, I moved from VirtualBox, were set up using passwords, so the same behaviour will be the best way
Hi All,
I added the public ssh key to the oneadmin in sunstone. But when I deploy a VM e.g. the Debian 8.2 kvm the template holds the public key. Never the less a root login via the vnc doesn’t work.
What I’m doing wrong.
Thx
Regards
Thomas
@jonny12,
the ssh public key is used to login to the VM via the SSH protocol. For VNC console the root password must be set via the contextualization.
@vialcollect,
please add some more info, like
onetemplate show <templateID> --xml
onevm show <vmID> --xml (but please strip the PCI info -it is a lot and not related to the issues)
Some more info - like the version of opennebula, what steps are completed, configurations, etc. It is hard to guess what is the overall setup and where the problems could be…
Hi Anton,
now I managed it or moreover I understand how it works. The passwordless login for root only works via the frontend machine as oneadmin user.
So on the frontend machine:
su oneadmin
ssh@192.x.x.x (new machine)
Then I can admin this machine.
Thank you for your help.
Regards
Thomas
Hi all, i want to login to the centos kvm downloaded from the marketplace, and so i copy the id_rsa.pub in the contextualization of the template but when the vm is running it require an username and password again…what i’m doing wrong. thank you very much for any help.
Hi Florin_Tanasache1, the centOS image will have they ssh key of the user who as far as i know owns the VM. once you place the ssh key in the contextualization of the VM make sure you shut it down and start it again since as far as i know it needs to be injected during bootup.
When this is done you need to ssh to the centos KVM vm from the machine that has the private key associated with the public key that you just placed in the VM via the contextualization. This machine is most probably your front-end. Then #ssh root@IP-of-the-centos-KVM-VM
thanks for your response, but it does not work. Moreover i cannot ping the vm centos-kvm from my frontend (in my case the frontend is the host having the vms). can i use vnc to do this? sorry, but i’m newbie with opennebula
An ssh key as the name implies is used only by the SSH protocol. When you use VNC that is a console session, just like having a keyboard and a mouse attached to a physical machine.
ok, now after i changed the network interface i can ssh to the centos and a have access to the root of machine. thank you very much. However, if i want to use the vnc console what have i do? which are the credentials in order to access the machine?
The root password has public key authentication enabled so the easiest way would be:
1- SSH to the vm using the root username
Create a new user by:
2- useradd centos
3- passwd centos à type a password here
4- try using this user via the console (VNC)
the steps above are not specific to OpenNebula, but mainly Linux administration, I am just saying to make sure that you understand that this is not an OpenNebula “problem”