KeepassXC - SSH-Agent integration

Hi there. I didn’t get KeepassXC integration to work as expected. I have created a systemd unit as described in the documentation at Using KeepassXC to manage SSH keys. It seems that this systemd service is starting. At leas i see a ss-agent process running. But after autostarting KeepassXC, there is a red exclamation, that KeepassXC cant find the running process. If i restart the systemd service when KeepassXC is running (systemctl restart --user ssh-agent) the ssh-agent is also found by KeepassXC. Is there a better way to archive ssh-agent integration?

You need to keep sure that Keepass is waiting for ssh-agent until it is up and running. How do you autostart Keepass? Maybe add a check to the autostart script.

Maybe also this:


That keep sure that it starts before the graphical target.

I have only enabled the autostart feature in KeepassXC itself. After that, I found it in system settings > autostart. I have no idea which file this is the filesystem.

It is located here: ~/.config/autostart/

Many thx. Yes there is a file org.keepassxc.KeePassXC.desktop with the content set to:

[Desktop Entry]

If i look on the shell, without KeepassXC is started, i see a process ssh-agent. But when i start no KeePassXC manually, i get the warning, that no agent is running.

You could set a higher delay… lets say 10 sec.

After fiddling around, it seems that ssh-agent process in the screenshot, is not the one startet by the self-created systemd service. But i have no idea how to check from where this process comes and how to start the one from systemd instead. And ye, i have enabled the service after systemctl daemon-reload.

systemctl status --user ssh-agent
systemctl cat --user ssh-agent
journalctl --user --boot 0 --unit=ssh-agent
journalctl --boot 0 --grep=ssh
systemctl --user daemon-reload

Hmmm systemctl status --user ssh-agent gives me a failure… INVALIDARGUMENT

ssh-agent.service - SSH key agent
     Loaded: loaded (/home/username/.config/systemd/user/ssh-agent.service; enabled; vendor preset: enabled)
     Active: inactive (dead) since Sun 2022-05-22 20:59:29 CEST; 7min ago
   Main PID: 4082 (code=exited, status=2)
        CPU: 9ms

Mai 22 20:46:13 MSI systemd[1334]: Started SSH key agent.
Mai 22 20:46:13 MSI ssh-agent[4082]: SSH_AUTH_SOCK=/run/user/1000/ssh-agent.socket; export SSH_AUTH_SOCK;
Mai 22 20:46:13 MSI ssh-agent[4082]: echo Agent pid 4082;
Mai 22 20:59:29 MSI systemd[1334]: Stopping SSH key agent...
Mai 22 20:59:29 MSI systemd[1334]: ssh-agent.service: Main process exited, code=exited, status=2/INVALIDARGUMENT
Mai 22 20:59:29 MSI systemd[1334]: ssh-agent.service: Failed with result 'exit-code'.
Mai 22 20:59:29 MSI systemd[1334]: Stopped SSH key agent.

The content:

Description=SSH key agent

# DISPLAY required for ssh-askpass to work
ExecStart=/usr/bin/ssh-agent -D -a $SSH_AUTH_SOCK


i used because gives me an error

It seems i have found the issue. Have now changed the content to:

Description=SSH key agent

ExecStart=/usr/bin/ssh-agent -D -a $SSH_AUTH_SOCK


After a restart of the Laptop, the service seems to work.

1 Like

Many thx for your help. Now im happy with my current Keepass setup…

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