Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

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?

share|improve this question
    
If you use the same password for your keyrings as for your login, you shouldn't have to unlock them. –  JanC Nov 12 '10 at 5:48
1  
@JanC That won't work if you're using auto-login –  fluteflute Nov 12 '10 at 8:46
add comment

2 Answers

up vote 9 down vote accepted
+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 .gnome2/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.

share|improve this answer
    
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? –  Syzygy Jul 29 '11 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 '11 at 18:17
add comment

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

share|improve this answer
    
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 '10 at 1:08
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.