Using SSH keys for connection in Custom Scripts #15363
-
I have a small script that uses Junos PyEZ to connect to Juniper devices. This library allows to use SSH keys from file or SSH Agent for connection. Is it possible to run scripts via UI from another user? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
To do that you would have to create a new queue, with its own netbox-rq worker, running as a different user. But it still wouldn't be able to find your ssh-agent, unless you set the environment variable
By starting ssh-agent as the parent process of the netbox-rq worker, and then connecting to the agent to load your key and your passphrase (with ssh-add). When invoking ssh-add, you can set |
Beta Was this translation helpful? Give feedback.
To do that you would have to create a new queue, with its own netbox-rq worker, running as a different user. But it still wouldn't be able to find your ssh-agent, unless you set the environment variable
SSH_AUTH_SOCK
. (This is normally present in your shell environment, when you are running commands interactively).By starting ssh-agent as the parent process of the netbox-rq worker, and then connecting to the agent to load your key and your passphrase (with ssh-add). When invoking ssh-add, you can set
SSH_AUTH_SOCK
explicitly to point to the correct socket location.