Strange behaviour for using $SSH_AUTH_SOCK after update

On my Gnome system i start ssh-agent and set $SSH_AUTH_SOCK via a --user systemd service like this:

[Unit]
Description=SSH key agent

[Service]
Type=simple
Environment=SSH_AUTH_SOCK=%t/ssh-agent.socket
# DISPLAY required for ssh-askpass to work
Environment=DISPLAY=:0
ExecStart=/usr/bin/ssh-agent -D -a $SSH_AUTH_SOCK

[Install]
WantedBy=default.target

After login to Gnome, it autostarts KeepassXC and in that, i could make use of $SSH_AUTH_SOCK and use the SSH-Agent integration. Since the update this week, this integration isn’t working anymore as expected. KeepassXC complains that no ssh-agent is executed.

If i open a console and check the systemd service, i see it enabled and active. If i use printenv | grep SSH_AUTH_SOCK on the same console it prints the expected var and path. If i start KeepassXC again from the Gnome Arch menu or Dock, the ssh-agent integration is not working. But when i start keepassxc from the same console as where i check the env var, the integration works.

I get the same behaviour for all other applications which make use of $SSH_AUTH_SOCK.

Any idea, what’s wrong after the update or how to solve this?

1 Like

Have you something like

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

in your ~/.pam_environment? It’s not evaluated any more since the last update (deprecated). Take a look at AUR (en) - systemd-ssh-agent how to set this at another place.

1 Like

Yepp. I have exactly this line in ~/.pam_environment. If i understand the link correct, i should now use:

$ cat /etc/profile.d/ssh_auth_sock.sh
#!/bin/sh
export SSH_AUTH_SOCK="$XDG_RUNTIME_DIR/ssh-agent.socket"

Is this correct?

After installing the mentioned systemd-ssh-agent, integration works again. Many thx for pointing me to this.

It also works by adding

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

to your ~/.bashrc or ~/.zshrc

that’s what I thought at first. Unfortunately, this way did not work for unknown reasons. Im using bash…

I also had to manually override the value of SSH_AUTH_SOCK in keepassxc, value was empty. Maybe that did it for me?

Screenshot_20221104_173634

Though, I would prefer the other way if the value is detected automatically.

The other way works automatically. This is important, since with that, i can use it in other applications to.

If you dont want to install the AUR package, you can create the shell script and insert, the content by yourself. You must do that with root privileges. For example on the shell:

sudo nano /etc/profile.d/ssh_auth_sock.sh

then insert both lines:

#!/bin/sh
export SSH_AUTH_SOCK="$XDG_RUNTIME_DIR/ssh-agent.socket"

Save this with Ctrl + X > Enter
Make it executable with: sudo chmod +x /etc/profile.d/ssh_auth_sock.sh

1 Like

Ah nice, I tried this and removed all my other manipulations :stuck_out_tongue_closed_eyes: and its working automatically.
Thanks for checking!

PS: making it executable wasn’t necessary

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.