Remove a password from the gnu-keyring without deleting the associated key

I have a gpg key. When I first added this key, Fedora prompted me for a password and asked if I would like to add this password to my key ring. I did and now I would like to remove the password from the key ring. How can I do this without deleting the gpg key? Most sources seem to recommend using seahorse to manage the passwords in the key ring, but I cannot seem to find anyone describing how to use seahorse to remove a password. I see how to completely delete a key using seahorse. But this is not what I want.

I have also looked at the tool secret-tool, which does seem to have a command for removing a password, namely clear. However, since the password was originally added from the gui, I do not know how to search for or find this password with secret-tool. I tried following the suggestions in this answer, but running secret-tool search --all xdg:schema org.gnome.keyring.Note did not list any results. This could be because I did not actually use seahorse to add the password (I did not have seahorse installed at the time). Instead I just added the password through Fedora’s gui prompt.

How can I remove a password from the gnu-keyring that was added via Fedora’s gui prompt without deleting the associated key? Additionally, is there any way to use secret-tool to list all keys added to the gnu-key ring via Fedora’s gui prompt?

secret-tool search --all xdg:schema org.gnupg.Passphrase
1 Like

oh, wow, thank you.

1 Like

Follow up question, how did you determine the attribute and value to search by? Say I wanted to do a similar search for ssh keys. How would I figure out on my own what I need to search by?

secret_items() {
	busctl -j --user get-property \
		org.gnome.keyring /org/freedesktop/secrets \
		org.freedesktop.Secret.Service Collections \
	| jq -r '.data[]' \
	| while read -r COLLECTION
	do busctl -j --user get-property \
		org.freedesktop.secrets "${COLLECTION}" \
		org.freedesktop.Secret.Collection Items \
	| jq -r '.data[]' \
	| while read -r ITEM
	do busctl -j --user call \
		org.freedesktop.secrets "${ITEM}" \
		org.freedesktop.DBus.Properties \
		GetAll s org.freedesktop.Secret.Item \
	| jq -r '.data[]|pick(.Attributes,.Label)'
	done
	done
}
secret_items
1 Like