[SOLVED] How to substitute the value SSH_PUBLIC_KEY with the output of cat ~/.ssh/id_rsa.pub

Hi all!!
I’m trying to install opennebula on ubuntu with virtualbox
I’m following this guide
http://docs.opennebula.org/4.12/design_and_installation/quick_starts/qs_ubuntu_kvm.html#qs-ubuntu-kvm
at step "3.2. Adding virtual resources"
I don’t know how to
"Substitute the value above with the output of cat ~/.ssh/id_dsa.pub"
wich command I have to enter to copy the password on
EDITOR=vi oneuser update oneadmin
Thank you!!!

When you try to connect to machine using openssh some of distros now dont let user root connect directly using password authentication method you should use ssh keys .
here it tells you to copy whats inside this file ~/.ssh/id_dsa.pub or ~/.ssh/id_rsa.pub and assign it to a variable named SSH_PUBLIC_KEY after that it let you connect to all instances of user oneadmin with login as root and no password .
if you dont have one of these files create using ssh-keygen command .
why you dont use opennebula sunstone for starting ?

I’m following the guide…it says the same as you…but I don’t know how to do with the command line…
copypaste doesn’t work :frowning:
if I open ~/.ssh/id_rsa.pub, copy, and then open EDITOR=vi oneuser update oneadmin
i can’t paste it :frowning::frowning:

…furthermore copying the key entering it char by char is impossible…

but if you say I can do the same via sunstone…I will try!!

You can try with this :

$ echo SSH_PUBLIC_KEY="`cat ~/.ssh/id_dsa.pub`" > tmpfile
$ oneuser update oneadmin -a tmpfile
$ rm -f tmpfile
2 Likes

Thank you it worked!!!
I edited something

$ echo SSH_PUBLIC_KEY='"'`cat ~/.ssh/id_dsa.pub`'"' > tmpfile
$ oneuser update oneadmin -a tmpfile
$ rm -f tmpfile

note the ' " ' before and after
because I need the key to be between " "

Thanks @Arash and @michaudg for your precious support!!