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:
[Install]
WantedBy=multi-user.target
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]
Name=KeePassXC
GenericName=Passwortmanager
Exec=/usr/bin/keepassxc
TryExec=/usr/bin/keepassxc
Icon=keepassxc
StartupWMClass=keepassxc
StartupNotify=true
Terminal=false
Type=Application
Version=1.0
Categories=Utility;Security;Qt;
MimeType=application/x-keepass2;
X-GNOME-Autostart-enabled=true
X-GNOME-Autostart-Delay=2
X-KDE-autostart-after=panel
X-LXQt-Need-Tray=true
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:
[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
i used default.target
because multi-user.target
gives me an error
It seems i have found the issue. Have now changed the content to:
[Unit]
Description=SSH key agent
[Service]
Type=simple
Environment=SSH_AUTH_SOCK=%t/ssh-agent.socket
ExecStart=/usr/bin/ssh-agent -D -a $SSH_AUTH_SOCK
[Install]
WantedBy=default.target
After a restart of the Laptop, the service seems to work.
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.