15

I've ended up with two password keyrings - one from old laptop and one from current installation.

How do I merge the two password keyrings into one so that I don't have to unlock both of them at login?

3
  • If you use the same password for your keyrings as for your login, you shouldn't have to unlock them.
    – JanC
    Nov 12, 2010 at 5:48
  • 1
    @JanC That won't work if you're using auto-login
    – 8128
    Nov 12, 2010 at 8:46
  • It doesn't work for me and I don't use autologin :(
    – Severo Raz
    May 22, 2015 at 22:53

2 Answers 2

12
+50

When you remove the password from your keyrings, gnome keyring manager will save the files as clear text. You can edit those files with a text editor and copy the keys around. Set a password to have the keyring files encrypted again.

I suggest you backup your keyring files before doing this.

I assume you have two keyrings like this:

two keyrings

And the keyring files looking like this:

$ cd ~/.local/share/keyrings
$ file foo.keyring bar.keyring 
foo.keyring: GNOME keyring, major version 0, minor version 0, crypto type 0 (AEL), hash type 0 (MD5), name "foo", last modified Thu Jan  1 01:00:00 1970, created Thu Jan  1 01:00:00 1970, not locked if idle, hash iterations 1087, salt 10888099772058093604, 1 item(s)
bar.keyring: GNOME keyring, major version 0, minor version 0, crypto type 0 (AEL), hash type 0 (MD5), name "bar", last modified Thu Jan  1 01:00:00 1970, created Thu Jan  1 01:00:00 1970, not locked if idle, hash iterations 1749, salt 12972167437702069911, 1 item(s)

Remove the password from the two keyrings. To remove the password you have to change the password (right click > change password), enter the old password and leave the new password blank. A dialog will prompt you to verify that you want to store your passwords unencrypted.

Now your files should look like this:

$ file foo.keyring bar.keyring 
foo.keyring: ASCII text
bar.keyring: ASCII text
$ cat foo.keyring 

[keyring]
display-name=foo
ctime=0
mtime=0
lock-on-idle=false
lock-after=false

[1]
item-type=0
display-name=key1
secret=pass1
mtime=1311897928
ctime=0
$ cat bar.keyring 

[keyring]
display-name=bar
ctime=0
mtime=0
lock-on-idle=false
lock-after=false

[1]
item-type=0
display-name=key2
secret=pass2
mtime=1311900380
ctime=0

Edit the files using your favorite text editor. Make sure to change the section numbers so they are consecutive and do not overlap.

$ cat foo.keyring 

[keyring]
display-name=foo
ctime=0
mtime=0
lock-on-idle=false
lock-after=false

[1]
item-type=0
display-name=key1
secret=pass1
mtime=1311897928
ctime=0

[2]
item-type=0
display-name=key2
secret=pass2
mtime=1311900380
ctime=0

Back to the graphical keyring manager. Lock, then unlock the keyring so the changes take effect (right click > lock, right click > unlock). Alternatively you can close and reopen the keyring manager. You should now see all the keys you moved in one keyring.

two keyrings with keys moved

You can now set a password and the keyring files will once again be encrypted.

2
  • Great, do the apps find keys moved this way? That is, do apps look keys up based on a unique ID (which would it be?) or based on the keyring/name?
    – MarkovCh1
    Jul 29, 2011 at 16:03
  • 1
    @Syzygy: The gnome keyring API provides methods to search over all keyrings, but also to pick a specific key using keyring and id. It depends on the application whether it will search for a key or look for a specific keyring.
    – Lesmana
    Jul 29, 2011 at 18:17
-1

What format do you have these keyrings in? If you are managing them both in the Passwords and Encryption Keys dialog, can you not select all the keys in the "old laptop" keyring, right-click and choose Copy, and then Paste them into the other keyring?

A document describing the structure of a .keyring file: http://archpub20.cs.ccu.edu.tw/cgi-bin/dwww?type=file&location=/usr/share/doc/gnome-keyring/file-format.txt

1
  • The "gnome-keyring custom format as seen in $ cat ~/.gnome2/keyrings/*.keyring". Nope the copy option is not available on the stored passwords. As fas as I know copy = copy the public key into clipboard.
    – Dima
    Nov 12, 2010 at 1:08

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .