191

I am on Ubuntu and I have forgotten the password for my Gnome Keyring (yes, stupid me, I know). Any way I can get it back? I have already looked at this link, but it says it's not possible if my home directory is encrypted and unfortunately my home directory is encrypted.

Ravexina
  • 55,668
  • 25
  • 164
  • 183

6 Answers6

233

Resetting everything (delete all passwords and start new keyring):

rm ~/.local/share/keyrings/login.keyring

Then, log out and log back in. Ubuntu will automatically create a new login.keyring for you.

Or

Navigate to Places > Home. Press Ctrl + H to view "hidden files". Navigate to .local > share > keyrings and delete login.keyring

Using the same keyring (resetting keyring password but keeping old passwords in keyring):

  1. Make a backup of the keyring

     cd ~/.local/share/keyrings/
     cp login.keyring login.keyring.backup
    

and after that delete login.keyring file

    rm ~/.local/share/keyrings/login.keyring
  1. Create a new keyring file from Gnome Keyring with the name login

  2. Replace the new keyring file with the backup of the old keyring file

     cd ~/.local/share/keyrings/
     mv login.keyring.backup login.keyring      
    

Note: before Ubuntu 12.10 the path to the keyrings folder was ~/.gnome2/keyrings/ instead of ~/.local/share/keyrings/.

Bruno Pereira
  • 73,643
  • 13
    how to do step 2? – Frido Emans Feb 27 '15 at 13:04
  • @xxor: You create a new file there called login.keyring. –  Aug 25 '15 at 21:28
  • 2
    I thought it was a bit simple, it hasn't worked for me. It still says my password is wrong – Madivad Apr 23 '16 at 22:16
  • 16
    I wonder why (and how) resetting the keyring password while keeping old passwords should work. And indeed it doesn't work for me (it says "The unlock password was incorrect") – Scz Aug 15 '16 at 08:12
  • 13
    Indeed, "resetting keyring password but keeping old passwords in keyring" sounds absurd. – Alexey Aug 26 '16 at 12:52
  • 2
    I thought step 2 meant run seahorse, click on "File" in top menu and choose new, then select "Password Keyring", hit continue and enter for name "login". – eshaya May 03 '17 at 19:39
  • Using "Same Keyring" has not worked. – Satya Prakash Jul 24 '17 at 04:49
  • With Ubuntu 14.04 I found the file login.keyring in ~/.gnome2/keyrings, at variance with the answer above. – XavierStuvw Sep 04 '17 at 20:12
  • Denote that, if your OS is in a different language, this file "login.keyring" can be named differently. – Luis Lopez Mar 18 '19 at 02:03
  • 1
    for step 2, you need to goto "passwords and keys" from the application menu and click on '+' symbol to create a new Password Keyring. Keep the name as 'login'. It will automatically create a new file named login.keyring under ~/.local/share/keyrings/ directory – Manoj May 29 '19 at 12:41
  • 1
    this works but you have to log out and log in again after moving or deleting ~/.local/share/keyrings/login.keyring

    Then a new empty keyring is automagically created.

    you can rename the automaticly created file and put back the copy on ~/.local/share/keyrings/login.keyring

    But again, you need to close the login session and log in again and then you can use the old passwords, provided that you have the original password of the db

    – jringoot Dec 13 '19 at 09:30
  • root@mint:~/.local/share/keyrings# cp ./login.keyring ./login.keyring.backup cp: cannot stat './login.keyring': No such file or directory – SL5net Sep 03 '20 at 06:00
  • 1
    @Alexey and Scz - I don't understand. Is there a serious "security flaw" with Gnome Keyring? As you seem to imply, it doesn't make sense that someone can keep the old passwords in the keyring and then retrieve them if they forgot the encryption password. Unless I'm missing something, I certainly Hope the trick documented by Bruno does not work... – Shawn Eary Jul 09 '21 at 15:01
  • Removing login.keyring seems to have worked for me. Thank you. – Artur Łysik Apr 19 '23 at 09:14
  • Tried the 'resetting everything' - now booting my Ubuntu VM no longer starts Gnome. – gojomo Aug 29 '23 at 03:28
56
  1. Start up Ubuntu's Dash (top most icon in Unity or press Super)
  2. Type Pass to get Passwords and Keys and start this (this will start the Gnome Keyring frontend seahorse)
  3. Next
    • If the password is known: Under Passwords the default folder select unlock, or
    • If the password is not known: right mouse click and delete for resetting.

Next time Ubuntu will ask for a new password for the keyring.

rubo77
  • 32,486
bill
  • 561
16

Solved this by installing seahorse frontend.

8

The answer for removing the specific file for rm ~/.local/share/keyrings/login.keyring does not work on all forms of Ubuntu.

One should open up the file manager and show hidden files (CTRL + H). Then one should see .local/share/keyrings delete all of the files in this directory and you should be good to go.

caja

  • 2
    Works for me. i tried the other suggestions before. this is the first workings at my machine :) Linux Mint Version 20 – SL5net Sep 03 '20 at 06:08
  • 2
    THIS should be the accepted solution – Kleysley Feb 02 '22 at 13:31
  • Thanks, we don't even need to log out and log back in. Keyring is useful to store a VPN user key password so we can reconnect automatically in case we are disconnected (my Ethernet USB adapter keeps disconnecting me when I touch it or there is a vibration when typing too strong on the laptop keyboard). – baptx Mar 10 '22 at 15:54
3

I'm on Ubuntu MATE 16.04 and deleting files in ~/.local/share/keyrings/ didn't help me. What helped though is running seahorse and changing login password. I entered my current password and typed the same as new one. Then I logged out and logged is and my login password became password for Gnome2 Key Storage.

enter image description here

expert
  • 219
  • You don't want to delete the directory gnome-keyring, just the 2 files inside it. Then it will just make fresh files that have no passwords. – Brian May 27 '23 at 21:54
1

Um, this question and answers is all over the planet! I couldn't figure out what is going on. The distinction seems to be whether or not the old password is available. The most common cause of this problem is restoring /home/user after a clean OS upgrade during which the user's login password was changed, for whatever reason.

There are other possibilities, such as one mentioned that the login password was unacceptably short for gnome-keyring rules.

The following will not work to solve this problem: rm ~/.local/share/keyrings/login.keyring because there are two key rings, login and user So: rm ~/.local/share/keyrings/*.keyring will remove both.

It's really difficult for the problem to remain after deleting the key rings, since they no longer exist, and new ones must be created! This is the case when the password is unavailable.

With that option, you'll need to reenter your various passwords that were stored previously on the key ring, as you use the applications that require them. The key ring will remember each one, and that will be it.

If the old password is known, then gnome-keyring or seahorse can be used to change the password to the new login password, eliminating the need to keep entering it.

Brian
  • 334
  • So how to create new keyring? No i don't have a section of Password in seahorse at all! – holms Apr 02 '23 at 23:28