I am new in Opennebula (Version 4.12), a I have some basic questions…
How to access a virtual machine via ssh?
I have generated a ssh key using ssh-keygen with a linux user and afterwards I have copied this public key into the template SSH KEY, but sometimes it works, but others it doesn’t , any ideas??
Moreover we want to use each user SSH KEY instead filling the template SSH KEY but:
If I put the ssh key into User > Setting > Info it doesn’t work either
How does the ssh process work in opennebula fro login to a vm? How is the opennebula user’s ssh key moved into the virtual machine and how can i use this ssh key from any linux terminal?
Do we need the opennebula user to be the same as the linux user where we created the ssh key?
the os in vm must accept root ssh login from a key (configured in sshd config)
As for your questions:
a/
b/ the ssh key is moved from the sunstone user starting the VM by a script from the contextualization package into the root user ssh authorized keys.
c/ AFAIK the ssh key from any sunstone user is only put into the root ssh authorized keys. So any user can start the VM fro sunstone, but he/she only can ssh to rot user
Hi there, I am working with floprod and we are still having problems:
We are using images coming from templates from the marketplace that are already contextualized.
The ssh public key is correctly copied to the vm in /root/.ssh/authorized keys, I can check it if I use a context var PASSWORD and accesing as root.
I’m guessing that maybe the problem is with the default configuration sshd config. For example at Ubuntu16 marketplace image PermitRootLogin is password-porhibited but when I try log ssh to the Debian 8 and Debian 9 of the templates from the marketplace i’m asked for a password.
Or maybe is about the permissions of the vm /root/.ssh/ folrder and files within
it may be anything, try to log in using ssh -vv as i said, this will print you all the info that u need (a permission problem 4example) your ~/.ssh/authorized_keys must be readable of course.
Do u have your key protected with a pass? if this is the case you will need to use the ssh-agent.
this moning i have been checking Ubuntu 16.04, and i do not have any problem…
Here are a couple of things:
remember to ensure that your keys have defaults names if u do not want to provide extra options to ssh (i think id_* are default ones)
default sshd config has these two variables: PermitRootLogin and PasswordAuthentication. If u want to log in using password u should change that (use VNC if u cannot enter).
passwordless ssh sessions check by default: /home/[youruser]>/.ssh/authorized_keys, make sure that this folder exists in the user that u are trying to log in. Opennebula copies the key provided by sunstone/template there ALSO u need to have the right permissions.
If u are trying to log with a non-root user one way to perform this is using TEMPLATE/CONTEXT with a variable named USERNAME=“xxx” this will create automatically your user with a home folder.
i cant use right now your version (im in 5.4.0) but u can check the issue manually and see whats happens.
if after that you continue facing issues… im afraid that im not able to help you with only these info, use ssh -vvv and copy the log here. Anyways permision denied problems usually are related to keys/permissions setup.
SSH configuration procedure
Do this steps from oneadmin login(physical machine)
SSH Client: Physical Machine IP
SSH Remote Host: In our case, 192.168.108.40
Create Authentication in Physical Machine using ssh-keygen
ssh-keygen -t rsa