4

I use the i3wm window manager on Fedora, and the urxvt-mld terminal dæmon for my multipl urxvt-mlc terminal clients.

My problem is that I want just one ssh-agent for my entire session, and for the ssh-agent to be available to all of the terminal windows, which would most easily be done with

ssh-agent urxvt-mld

However, I can't figure out where to put that because of all the various files involved in X session and window manager startup.

Should it go in the i3 config file, read upon i3wm's startup? The problem I anticipate there is that restarting the window manager might close all the terminals. (Or might not, if the agent process is detached from the i3 process tree..)

I don't mind issuing one ssh-add command per session, but I'd like to be able to do it from any of the terminal windows. Hence the desire to make them all children of a process that ran ssh-agent.

Would a systemd user service be appropriate? What would the wants and requires be for that to get it to happen at the right time?

Thanks for any help!

RoUS
  • 203
  • 1
  • 9

1 Answers1

6

You can use Keychain. From the manpage,

keychain is a manager for ssh-agent, typically run from ~/.bash_profile. It allows your shells and cron jobs to share a single ssh-agent process. By default, the ssh-agent started by keychain is long-running and will continue to run, even after you have logged out from the system.

I have this line my zsh ~/.zshrc file:

eval $(keychain --eval --agents ssh --quick --quiet)

Yuri
  • 115
  • 3
snapshoe
  • 1,156
  • 8
  • 18