Ssh-agent and SSH_AUTH_SOCK

I have a fresh Manjaro installation.
I’ve installed Keepassxc and it told me, that no ssh-agent is running (as it miss SSH_AUTH_SOCK).

So I’ve switched to CLI and check it, and wonder about this:

image

If I execute ssh-agent, it shows that the SSH_AUTH_SOCK is set to /tmp, but if I echo this variable it return nothing.

Any Idea, whats wrong here?

Do you want KeepassXC as your ssh agent?

Yeah you’re not setting any variable. Exporting empty variable does nothing. Nevermind, I just can’t be arsed to read stupid screenshots of text. Don’t post images of text, copy and paste it as preformatted text </>.

You should export something like this: (in .zshenv or wherever)

export SSH_AUTH_SOCK="$XDG_RUNTIME_DIR/ssh-agent.socket"

No, KeepassXC is a Password-Manager that can inject SSH-Keys right into the agent (if need).
Therefor KeepassXC need to know where ssh-agent is up and running.

But as I shown above, it seems that ssh-agent not to export the ENV-Variable in right way

Ok, thanks.
Can I set this export in my .profile or /etc/environment ?
I mean .bashrc don’t make sense, as I also need it be present via KDE Autostart, right?!

Wherever works… :man_shrugging: I have it in .zshenv.

You didn’t indicate which Desktop/Window manager you’re using.

Typically, it should go in ~/.xprofile.

Ah ok, sorry, it’s KDE so it would be ~/.xinitrc

You’re using it wrong, ssh-agent prints the commands to export relevant variables as you see in that screenshot (which should have been copy+pasted text).
see
https://wiki.archlinux.org/title/SSH_keys#ssh-agent

This suspiciously sounds like it would only work as long as you’re using Xorg.
Perhaps using the existing systemd service will be more robust / future proof:
https://wiki.archlinux.org/title/SSH_keys#Start_ssh-agent_with_systemd_user

Starting it, yes, but exporting the environment variable still must be done somewhere.

Ok, you are right, is much cleaner to have it right in the .service-File.

By Default this is set

[Unit]
ConditionEnvironment=!SSH_AGENT_PID
Description=OpenSSH key agent
Documentation=man:ssh-agent(1) man:ssh-add(1) man:ssh(1)

[Service]
Environment=SSH_AUTH_SOCK=%t/ssh-agent.socket
ExecStart=/usr/bin/ssh-agent -D -a $SSH_AUTH_SOCK
PassEnvironment=SSH_AGENT_PID
SuccessExitStatus=2
Type=simple

[Install]
WantedBy=default.target

That is equal to what the screenshot (should be text) shows. But I wonder that Keepassxc don’t recognize it.

Because the environment variable does only exists for other systemd services and not for your desktop manager.

Ok, what to do to fix this?
Still don’t work, even