# Is the opennbula ssh agent supposed to work without any extra setup?

**URL:** <https://forum.opennebula.io/t/is-the-opennbula-ssh-agent-supposed-to-work-without-any-extra-setup/10685>\
**Category:** Product Support\
**Created:** [July 1, 2022, 7:07am UTC](https://forum.opennebula.io/t/is-the-opennbula-ssh-agent-supposed-to-work-without-any-extra-setup/10685 "2022-07-01T07:07:39Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![branislav\_k](https://yyz1.discourse-cdn.com/flex031/user_avatar/forum.opennebula.io/branislav_k/32/6205_2.png) [@branislav\_k](https://forum.opennebula.io/u/branislav_k)\
**Post date:** [July 1, 2022, 7:07am UTC](https://forum.opennebula.io/t/is-the-opennbula-ssh-agent-supposed-to-work-without-any-extra-setup/10685/1 "2022-07-01T07:07:39Z")

</div>

OS is debian 11

My issue is that it does not work until  
i do

> eval `ssh-agent -s` && ssh-add  
> Agent pid 289270  
> Identity added: /var/lib/one/.ssh/id\_rsa (oneadmin@on-front)

Then it works as expected I can ssh from front to nodes and back  
Easy check:  
before i do `eval `ssh-agent -s` && ssh-add`  
echo $SSH\_AUTH\_SOCK gives nothing  
ssh-add -L also nothing  
after i do `eval `ssh-agent -s` && ssh-add`  
echo $SSH\_AUTH\_SOCK gives  
`/tmp/ssh-C9E9lOi4eE2n/agent.289269`  
and ssh-add -L list the key

Output from systemctl status opennebula-ssh-agent.service

```auto
systemctl status opennebula-ssh-agent.service
● opennebula-ssh-agent.service - OpenNebula SSH agent
     Loaded: loaded (/lib/systemd/system/opennebula-ssh-agent.service; disabled; vendor preset: enabled)
     Active: active (running) since Fri 2022-07-01 09:36:15 EEST; 11min ago
    Process: 288891 ExecStartPre=/bin/sh -c echo SSH_AUTH_SOCK=$SSH_AUTH_SOCK > /var/run/one/ssh-agent.env (code=exited, status=0/SUCCESS)
    Process: 288892 ExecStart=/bin/sh -c exec /usr/bin/ssh-agent -a $SSH_AUTH_SOCK (code=exited, status=0/SUCCESS)
    Process: 288894 ExecStartPost=/bin/sh -c /usr/bin/ssh-add (code=exited, status=0/SUCCESS)
   Main PID: 288893 (ssh-agent)
      Tasks: 1 (limit: 4692)
     Memory: 604.0K
        CPU: 19ms
     CGroup: /system.slice/opennebula-ssh-agent.service
             └─288893 /usr/bin/ssh-agent -a /var/run/one/ssh-agent.sock

Jul 01 09:36:15 on-front systemd[1]: Starting OpenNebula SSH agent...
Jul 01 09:36:15 on-front sh[288892]: SSH_AUTH_SOCK=/var/run/one/ssh-agent.sock; export SSH_AUTH_SOCK;
Jul 01 09:36:15 on-front sh[288892]: SSH_AGENT_PID=288893; export SSH_AGENT_PID;
Jul 01 09:36:15 on-front sh[288892]: echo Agent pid 288893;
Jul 01 09:36:15 on-front sh[288895]: Identity added: /var/lib/one/.ssh/id_rsa (oneadmin@on-front)
Jul 01 09:36:15 on-front systemd[1]: Started OpenNebula SSH agent.

```

* * *

**Versions of the related components and OS (frontend, hypervisors, VMs):**  
Frontend 6.2.0.1

Obvious solution is to just  
`echo "export SSH_AUTH_SOCK=/var/run/one/ssh-agent.sock" >> ~oneadmin/.bashrc`, but I’m I supposed to?

---

<div class="post-metadata">

**Author:** ![branislav\_k](https://yyz1.discourse-cdn.com/flex031/user_avatar/forum.opennebula.io/branislav_k/32/6205_2.png) [@branislav\_k](https://forum.opennebula.io/u/branislav_k)\
**Post date:** [July 21, 2022, 9:56am UTC](https://forum.opennebula.io/t/is-the-opennbula-ssh-agent-supposed-to-work-without-any-extra-setup/10685/2 "2022-07-21T09:56:47Z")

</div>

No one tried this?

---

<div class="post-metadata">

**Author:** ![cgonzalez](https://yyz1.discourse-cdn.com/flex031/user_avatar/forum.opennebula.io/cgonzalez/32/7096_2.png) [@cgonzalez](https://forum.opennebula.io/u/cgonzalez)\
**Post date:** [July 21, 2022, 12:08pm UTC](https://forum.opennebula.io/t/is-the-opennbula-ssh-agent-supposed-to-work-without-any-extra-setup/10685/3 "2022-07-21T12:08:59Z")

</div>

Hi @branislav_k,

It should work without doing any extra step for the `oned` service. If you take a look at the `oned` service environment you should see something similar to the export you’re proposing:

```auto
$ cat /proc/`pgrep oned`/environ
...SSH_AUTH_SOCK=/var/run/one/ssh-agent.sock

```

This will make passwordles ssh work for the `oned` process. If you want to take advantage of the agent also when you’re logged as a `oneadmin` in the server terminal, you’ll need to manually export the env variable, or as you mentioned add it to the `.bashrc` file or similar.

---

<div class="post-metadata">

**Author:** ![branislav\_k](https://yyz1.discourse-cdn.com/flex031/user_avatar/forum.opennebula.io/branislav_k/32/6205_2.png) [@branislav\_k](https://forum.opennebula.io/u/branislav_k)\
**Post date:** [July 21, 2022, 2:39pm UTC](https://forum.opennebula.io/t/is-the-opennbula-ssh-agent-supposed-to-work-without-any-extra-setup/10685/4 "2022-07-21T14:39:38Z")

</div>

Ok thanks.  
Then this probably should be added to the docs, because all examples are saying that you as the user must test ssh from frontend to nodes etc. and I was expecting for it to work, but it doesn’t.

For example here  
[https://docs.opennebula.io/6.2/open\_cluster\_deployment/kvm\_node/kvm\_node\_installation.html#step-4-configure-passwordless-ssh](https://docs.opennebula.io/6.2/open_cluster_deployment/kvm_node/kvm_node_installation.html#step-4-configure-passwordless-ssh)
