Shell – Replacing the SSH agent in GNOME Shell, Wayland, and SystemD

environment-variablesfedoragnome-shellsystemdwayland

I'm using Fedora 24 (amd64), which is running GNOME 3/GNOME Shell as a desktop environment, using Wayland as the display server, and SystemD as the init. Pretty standard, out of the box, this is the way Fedora 24 ships.

My previous distribution was still using X, so I had a script called 90-gpg-agent in /etc/X11/Xsession.d/autostart which conditionally started gpg-agent or sourced its exported variables, making them available to graphical programs that started. This made it so that programs like unison-gtk would have the correct SSH_AUTH_SOCK environment variable so they could use gpg-agent as the SSH agent. Anything running inside a bash session would just use the environment variables in my .bashrc, but graphical applications needed this to be exported for access.

Is there an equivalent for Wayland/GNOME/SystemD which will export these environment variables and provide them to applications starting in that display server+desktop environment?

Best Answer

Try using systemctl --user import-environment SSH_AUTH_SOCK in a script in /etc/X11/xinit/xinitrc.d/. Check out /etc/X11/xinit/xinitrc.d/50-systemd-user.sh for reference.

Related Question