Skip to content

ssh agent - "Key identity ownership conflict. Refusing to add." #5895

Closed

Description

@frederickjh

Overview

I have two databases. I recently added new ssh keys (all ED25519) to them. Two ssh keys to one database and one to the other. Today I realized that some of my ssh keys were not being removed from the ssh-agent on Linux when the database is closed, as I went to login and the ssh key was present in the ssh-agent but all databases were closed in KeepassXC.

I used ssh-add -D to remove all keys from the ssh-agent. I then unlocked the databases but only the three new ssh keys from the two database were added to ssh-agent. None of the other ssh keys that should have been added from KeepassXC were added.

Note: All keys that have this issue have the following three check-boxes checked:
[x] Add key to agent when database is opened/unlocked
[x] Remove key from agent when database is closed/locked
[x] Require user confirmation when key is used

When using the right-click menu or the Ctrl + H shortcut key the ssh keys with this issue ares not added and no error message is displayed.

image

When the ssh key database entry is opened and one goes to the SSH Agent section. If one then uses the Add to agent button the ssh key is not added and the error message: "Key identity ownership conflict. Refusing to add." is displayed at the top in a red banner.

image

Steps to Reproduce

NOTE: I am not totally certain of the step to reproduce. This happened over time and I am trying to remember all the things that I did in case they are meaning full to this issue

  1. Create multiple ssh key entries using RSA keys in two open database.
  2. Clone the RSA ssh key entries without their history and replace the ssh keys with new ED25519 keys
  3. Clone other password entries without history and turn them into ED25519 ssh key entries
  4. Close the databases and see if all KeepassXC ssh keys are removed.
  5. If not remove them using the command line ssh-add -D on Linux.
  6. Open the database and see if all KeepassXC ssh keys are added to the agent.

Expected Behavior

Keys that are marked to be added when a database is opened or unlocked should added and keys that are marked to be removed when the database is closed or locked should be removed.

Actual Behavior

Keys that are marked to be added when a database is opened or unlocked are not all added and keys that are marked to be removed when the database is closed or locked are not all removed.

Context

I have checked the UUIDs on the old and the cloned entries and they appear to have different UUIDs.

KeePassXC - Version 2.6.2
Revision: e9b9582

Qt 5.5.1
Debugging mode is disabled.

Operating system: Ubuntu 16.04.7 LTS
CPU architecture: x86_64
Kernel: linux 4.4.0-119-generic

Enabled extensions:

  • Auto-Type
  • Browser Integration
  • SSH Agent
  • KeeShare (signed and unsigned sharing)
  • YubiKey
  • Secret Service Integration

Cryptographic libraries:
libgcrypt 1.8.1

Operating System: Linux
Desktop Env: Unity
Windowing System: X11

Activity

  1. changed the title [-]ssh agent - Key identity ownership conflict. Refusing to add.[/-] [+]ssh agent - "Key identity ownership conflict. Refusing to add."[/+] on Jan 5, 2021
  2. hifi commented on Jan 6, 2021

    @hifi
    Member

    This should only happen if you have the same key in two different databases that are opened simultaneously. Have you checked that all of the keys you have are unique? The fact that you mentioned cloning do suggest that it's possible you have the same key in both.

    The slowness of opening the entry edit should also happen only if your key is heavily encrypted and it takes a while to decrypt as it's not offloaded to a thread. If not, something else is going on.

  3. frederickjh commented on Jan 7, 2021

    @frederickjh
    Author

    @hifi I double checked and all the keys are unique. KeepassXC refusing to add a key to the agent was also happening when I had only one database open.

    Not sure what happened but I was having this issue. After your reply I tried to see what possible cause I could locate. I created a new test database and tested several scenarios. As I was doing a save in the test database KeepassXC locked up, turned grey and never responded after that. Tried the termination signal several times with out a response then finally send the kill signal. Not sure that has ever happened before with KeepassXC.

    In any case after restarting KeepassXC, now no matter what databases I have open the SSH keys that are set to load on open /unlock and remove on close/ lock work correctly. Previously to the restart, I had tried closing all database and reopening them, but it looks like the restart of KeepassXC was what solved it. Load times when editing entries are also back to normal open times.

    You can close this or leave it open if you think others might also have this issue in the future. Not sure if there is anything more that can be done to pin this down or if it was a one-off bug.

  4. frederickjh commented on Jan 7, 2021

    @frederickjh
    Author

    This should only happen if you have the same key in two different databases that are opened simultaneously.

    It might be a good idea to add this information to the error message that is displayed.

  5. PolyMMA commented on Jan 19, 2021

    @PolyMMA

    I just experienced the same thing as described above.

    ssh-add -L showed no loaded key. No freeze though.

    After locking, and restarting the software, it worked like a charm.

    KeePassXC - Version 2.6.3
    Revision: beae186
    
    Qt 5.9.5
    Debugging mode is disabled.
    
    Operating system: Ubuntu 18.04.5 LTS
    CPU architecture: x86_64
    Kernel: linux 4.15.0-132-generic
    
    Enabled extensions:
    - Auto-Type
    - Browser Integration
    - SSH Agent
    - KeeShare (signed and unsigned sharing)
    - YubiKey
    - Secret Service Integration
    
    Cryptographic libraries:
    - libgcrypt 1.8.1
    
    
  6. frederickjh commented on Jan 19, 2021

    @frederickjh
    Author

    This has happened to me again too. What I see is that the keys are not removed from the agent and then KeepassXC refuses to add them. Even if one removes them from the ssh-agent outside KeepassXC using ssh-add -D. Interestingly no warning messages are shown when unlocking or locking a dadabase if ssh keys cannot be added or removed. This is only shown in the edit screen when using the buttons there to add or remove a ssh key. Maybe warnings should be shown when locking or unlocking a database if there is a failure.

    Not sure if this is happening when the computer goes to sleep, but I will realize that the keys are in the ssh-agent after I come back to the computer and KeepassXC has no open or unlocked databases. At that point to get KeepassXC adding and removing ssh keys to the agent, I do ssh-add -D to remove the keys and close and restart KeepassXC. I will endevour to figure out when the keys are getting left in the ssh-agent to see if i can find a set of step that will duplicate this.

  7. PolyMMA commented on Jan 20, 2021

    @PolyMMA

    After some more testing I can also confirm that there is an issue with handling the SSH keys after suspending and waking the system. Upon waking the system, running "Add key to SSH agent" (or via Ctrl+H) did not load the key to SSH-agent and was not visible using ssh-add -L. Restarting the program and unlocking again solved the issue like before and SSH-key was loaded to the agent.

    [Edited, added 2021-01-21]
    Also, when the DB is locked manually, the key in SSH agent is not cleared. Tried this after reboot without any system suspending. Though the system did lock after some time of inactivity.

    [Edited, added 2021-01-21]
    Just realized that I have the gnome-keyring-deamon running and that might be the cause of the issues. Will investigate more. KeePassXC>Settings>Secret Service Integration gives the following error:

    Warning: Another secret service is running (PID: 7673, Executable: /usr/bin/gnome-keyring-daemon).
    Please stop/remove it before re-enabling the Secret Service Integration
    

    inxi output:

    System: Kernel: 4.15.0-132-generic x86_64 bits: 64 gcc: 7.5.0
            Desktop: Xfce 4.14.2 (Gtk 3.22.30) info: xfce4-panel dm: lightdm Distro: Ubuntu 18.04.5 LTS
    
  8. tviard75 commented on Feb 9, 2021

    @tviard75

    I can also confirm the issue. Downgraded to 2.6.0 and it works as expected.

  9. hifi commented on Feb 21, 2021

    @hifi
    Member

    2.6.4 should have this fixed. Does anyone with this issue still have it with 2.6.4?

  10. frederickjh commented on Feb 22, 2021

    @frederickjh
    Author

    @hifi I just tested on my computer.

    • Fresh start of computer

    • started KeePassXC

    • Checked the ssh agent to see what keys were loaded, none.

    • Logged into one database on KeePassXC

    • Checked the ssh agent to see what keys were loaded, keys set to auto load were loaded.

    • Put computer into suspend

    • Brought computer out of suspend

    • Checked the ssh agent to see what keys were loaded, keys set to auto load were still loaded.

    • Switched to KeePassXC window and was surprised to see that the database was still unlocked!

    • I checked my setting and found that Lock databases when session is locked or lid is closed is checked.

    • I then locked the database.

    • All the auto remove keys were removed from the ssh-agent.

    • Unlocked the database and all the auto-add keys were added to the ssh-agent.

    So, I think that while this issue maybe solved a new issue may have been created of the databases not locking when the computer goes into suspend. I need to check the issue queue to see if there is an issue open regarding this. However, for me these results are not conclusive as KeePassXC did not lock the databases on suspend so it is hard to tell if just locking the database manually has the same effect.

  11. frederickjh commented on Feb 22, 2021

    @frederickjh
    Author

    @hifi I did not find another issue regarding the databases not locking on suspend. Should I open a new issue regarding this?

  12. droidmonkey commented on Feb 22, 2021

    @droidmonkey
    Member

    My database locks just fine on suapend, we didn't touch that code. For this purpose you can just lock the databases using the toolbar button. There is no functional difference.

  13. tviard75 commented on Mar 5, 2021

    @tviard75

    I just tried with 2.6.4 on Linux Ubuntu 20.04.2 LTS.

    1. ssh-add -l => no keys
    2. unlocking keypass db
    3. ssh-add -l => keys are listed
    4. locking keypass db
    5. ssh-add -l => no keys
    6. unlocking keypass db
    7. ssh-add -l => keys are listed

    So this issue is fixed for me.

    Also locking session, locks also keypass db for me.

    Cheers,

    Thomas

  14. frederickjh commented on Mar 5, 2021

    @frederickjh
    Author

    I am going to close this as the issue at hand has been fixed. The databases not locking may have been an issue with the windows manager I am running as it does not seem to be happening any more.

  15. ioistired commented on Sep 8, 2021

    @ioistired

    I am still experiencing this in v2.6.6.

  16. dkebler commented on Apr 28, 2024

    @dkebler

    Sorry to necro this closed issue but was experiencing the same here in 2024 and google search took me here.

    What I have discovered is that a key with encoding ecdsa-sha2-nistp521 has this issue but not ssh-ed25519 so maybe this issue is related to the key encryption.

  17. mateuszdrab commented on Jul 2, 2026

    @mateuszdrab

    Still seeing it in version 2.7.12. Usually solved after restarting keepassxc.

  18. cblanken commented on Jul 17, 2026

    @cblanken

    Just confirming I am also still seeing this in KeepassXC 2.7.12 like mateuszdrab.

    Clearing the agent via KeepassXC or directly with ssh-add -D doesn't resolve it. The same error remained after locking the database and re-opening it. Exiting and re-launching the KeepassXC application was the only solution I found.

  19. underclockeddev commented on Sep 25, 2026

    @underclockeddev

    I had the same issue, here's a proposed fix #13705

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions