Search Support

Avoid support scams. We will never ask you to call or text a phone number or share personal information. Please report suspicious activity using the “Report Abuse” option.

Learn More

How to print out my passwords in Firefox? I need to migrate user names and passwords for various web sites to a new computer

  • 18 پاسخ
  • 1 has this problem
  • 1 view
  • آخرین پاسخ توسّط cor-el

more options

https://support.mozilla.org/en-US/questions/1253828 does not seem to work because the caret (») is not visible in Firefox 72.0.2 (64-bit) that is on my machine. This is most annoying. Firefox and T'Bird are the most difficult software to migrate to new computers.

I need the export as a CVS. The other approaches either don't allow copy and paste or they are JSON and I have no clue how rto use that.

The other angle: logins.json (passwords) and key4.db (58+) for Passwords saved in the Password Manager I don't see a way to get that into a spreadsheet.

It is particularly annoying because there is an import function but no export function. I have over 300 web site user names and passwords. Hours and hours of work to just copy one at a time.

https://support.mozilla.org/en-US/questions/1253828 does not seem to work because the caret (») is not visible in Firefox 72.0.2 (64-bit) that is on my machine. This is most annoying. Firefox and T'Bird are the most difficult software to migrate to new computers. I need the export as a CVS. The other approaches either don't allow copy and paste or they are JSON and I have no clue how rto use that. The other angle: logins.json (passwords) and key4.db (58+) for Passwords saved in the Password Manager I don't see a way to get that into a spreadsheet. It is particularly annoying because there is an import function but no export function. I have over 300 web site user names and passwords. Hours and hours of work to just copy one at a time.

Modified by SFSecurity

Chosen solution

Oops, yes signons isn't defined with only the import code. You can use this code or use the full code (export and import).

/* import Logins from JSON */
if (logins = prompt("Array of JSON Logins",logins||"")){
try {
 logins = JSON.parse(logins);
 var i,lg;
 for (i=0; lg=logins[i]; i++){if (!lg.origin){lg.origin = lg.hostname}}
 ChromeUtils.import("resource://gre/modules/LoginHelper.jsm");
 LoginHelper.maybeImportLogins(logins);
} catch(e){ console.log(e); }
}

It would work with the full code because that defines the var. That would also allow to backup existing logins.

/* export current logins as JSON */
logins = prompt("Logins",JSON.stringify(Services.logins.getAllLogins()));

/* import Logins from JSON */
if (logins = prompt("Array of JSON Logins",logins||"")){
try {
 logins = JSON.parse(logins);
 var i,lg;
 for (i=0; lg=logins[i]; i++){if (!lg.origin){lg.origin = lg.hostname}}
 ChromeUtils.import("resource://gre/modules/LoginHelper.jsm");
 LoginHelper.maybeImportLogins(logins);
} catch(e){ console.log(e); }
}
Read this answer in context 👍 0

All Replies (18)

more options

I started this because I didn't see how to edit my original post at first.

Modified by SFSecurity

more options

You can copy logins.json and key4.db from one profile to another profile to migrate the logins.


You can copy files like these with Firefox closed to the current profile folder to recover specific data.

  • bookmarks and history: places.sqlite
  • bookmark backups: compressed .jsonlz4 JSON backups in the bookmarkbackups folder
  • cookies.sqlite for the Cookies
  • formhistory.sqlite for saved autocomplete Form Data
  • logins.json (passwords) and key4.db (58+) or key3.db (57 and older) (decryption key) for Passwords saved in the Password Manager
    if you only have key3.db then make sure to remove an existing key4.db
  • cert9.db (58+) or cert8.db (57 and older) for (intermediate) certificates stored in the Certificate Manager
    if you only have cert8.db then make sure to remove an existing cert9.db
  • persdict.dat for words you added to the spelling checker dictionary
  • permissions.sqlite for Permissions and possibly content-prefs.sqlite for other website specific data (Site Preferences)
  • sessionstore.jsonlz4 for open tabs and pinned tabs (see also the sessionstore-backups folder)

See also:

more options

Try this:

Type (or paste)

chrome://passwordmgr/content/passwordManager.xul

in the address bar and press Enter.

Your window will resize and, If you are not already signed in, enter your Master Password to Show logins and again to Show passwords.

You should then be able to print or screenshot your logins & passwords.

more options

You can use code in the Browser Console to export and import logins data.

To enable the command line in the Console:


/* export logins as JSON */
var logins = prompt("Logins",JSON.stringify(Services.logins.getAllLogins()));

/* import Logins from JSON */
var logins;
if (logins = prompt("Array of JSON Logins",logins||"")){
try {
 logins = JSON.parse(logins);
 var i,lg;
 for (i=0; lg=logins[i]; i++){if (!lg.origin){lg.origin = lg.hostname}}
 ChromeUtils.import("resource://gre/modules/LoginHelper.jsm");
 LoginHelper.maybeImportLogins(logins);
} catch(e){ console.log(e); }
}

Modified by cor-el

more options

RobertJ said

Try this: Type (or paste) chrome://passwordmgr/content/passwordManager.xul It displays the info but does not allow copy and paste or other export function. I somewhat knowledgeable but not enough to make this work without a more step by step set of instructions.
more options

cor-el said

You can use code in the Browser Console to export and import logins data. To enable the command line in the Console:


I somewhat knowledgeable but not enough to make this work without a more step by step set of instructions.

more options

You can open one of the developer tools (e.g. right-click on a web page: Inspect Element). Once the developer toolbox is open and has focus you can press the F1 key to go to the settings page.

On the settings page, look under Advanced settings and tick this item:

  • select "Enable browser chrome and add-on debugging toolboxes" in the developer tools settings

See:

  • https://media.prod.mdn.mozit.cloud/attachments/2018/07/09/16081/6b9847c8c30082f422b80889cd4fc755/dev_tools_settings.png

Once you have made this change, you should see a command line in the Browser Console.

You can paste the first part of the code in the command line. You probably need to type some text as a security measure to confirm that you want to paste text in the console.


/* export logins as JSON */
signons = prompt("Logins",JSON.stringify(Services.logins.getAllLogins()));

This should give you a prompt window that allows to copy the login data to the clipboard via Ctrl+C.

You can paste this login data in a text file and transfer this file to the other computer via a portable USB drive.

On the other computer you can repeat the first steps and enable the command line in the Browser Console in the same way (open a developer tool and press F1 to go to settings and tick the box).

You can then open the Browser Console and paste the second part of the code to import the logins. In the prompt you can paste the content of the file where you previously saved the JSON login data.


/* import Logins from JSON */
if (logins = prompt("Array of JSON Logins",signons)){
try {
 logins = JSON.parse(logins);
 var i,lg;
 for (i=0; lg=logins[i]; i++){if (!lg.origin){lg.origin = lg.hostname}}
 ChromeUtils.import("resource://gre/modules/LoginHelper.jsm");
 LoginHelper.maybeImportLogins(logins);
} catch(e){ console.log(e); }
}

Importing is done asynchronously and it can take a few second before the logins are available in the Password Manager.

Modified by cor-el

more options

cor-el said

You can open one of the developer tools (e.g. right-click on a web page: Inspect Element). Once the developer toolbox is open and has focus you can press the F1 key to go to the settings page. On the settings page, look under Advanced settings and tick this item:
  • select "Enable browser chrome and add-on debugging toolboxes" in the developer tools settings
See:
  • https://media.prod.mdn.mozit.cloud/attachments/2018/07/09/16081/6b9847c8c30082f422b80889cd4fc755/dev_tools_settings.png
================

I'm too tired to do this tonight but I think this will work. I greatly appreciate the step by step description of what to do. It helps prevent mistakes.

Allen

more options

SFSecurity said

I somewhat knowledgeable but not enough to make this work without a more step by step set of instructions.

Hello SFSecurity,

Type in the address bar :

chrome://passwordmgr/content/passwordManager.xul

Press Enter and maximize the window.

When you highlight an entry you will see a "Show Password" button at the bottom.

(until you highlight an entry that button will be greyed out)

You can highlight all entries; press Ctrl + C to copy the whole page, and then paste it (Ctrl + V).

Note that a few Firefox updates from now (probably Firefox version 73) this will change to :

"chrome://passwordmgr/content/passwordManager.xhtml

more options

McCoy said

SFSecurity said
I somewhat knowledgeable but not enough to make this work without a more step by step set of instructions.

Hello SFSecurity,

Type in the address bar :

chrome://passwordmgr/content/passwordManager.xul

Press Enter and maximize the window.

When you highlight an entry you will see a "Show Password" button at the bottom.

(until you highlight an entry that button will be greyed out)

You can highlight all entries; press Ctrl + C to copy the whole page, and then paste it (Ctrl + V).

Note that a few Firefox updates from now (probably Firefox version 73) this will change to :

"chrome://passwordmgr/content/passwordManager.xhtml

=========

My version of Firefox, 72.0.2 (64-bit) does not allow Copy and Paste.

Also the xhtml version gets this response:

File not found

Firefox can’t find the file at jar:file:///C:/Program Files (x86)/Mozilla Firefox/omni.ja!/chrome/toolkit/content/passwordmgr/passwordManager.xhtml.

   Check the file name for capitalization or other typing errors.
   Check to see if the file was moved, renamed or deleted.
more options

SFSecurity said

Also the xhtml version gets this response:

McCoy said

Note that a few Firefox updates from now (probably Firefox version 73) this will change to : "chrome://passwordmgr/content/passwordManager.xhtml

For now it is still :

chrome://passwordmgr/content/passwordManager.xul

SFSecurity said

My version of Firefox, 72.0.2 (64-bit) does not allow Copy and Paste.

Could you elaborate on that please ? You can't copy and paste no matter where ?

more options

You can only make a screenshot of the passwords in the legacy Password Manager if you use the chrome URI. There is no way to have a backup that you can restore this way.

It there aren't any passwords on the new computer or only a few then simply copy logins.json and key4.db to the profile folder on the new computer like I posted in my first reply.

If you need to preserve passwords you already have made then the procedure with code in the Browser Console will merge passwords.

more options

cor-el said

You can open one of the developer tools (e.g. right-click on a web page: Inspect Element). Once the developer toolbox is open and has focus you can press the F1 key to go to the settings page. On the settings page, look under Advanced settings and tick this item:
  • select "Enable browser chrome and add-on debugging toolboxes" in the developer tools settings
See:
  • https://media.prod.mdn.mozit.cloud/attachments/2018/07/09/16081/6b9847c8c30082f422b80889cd4fc755/dev_tools_settings.png
Once you have made this change, you should see a command line in the Browser Console. You can paste the first part of the code in the command line. You probably need to type some text as a security measure to confirm that you want to paste text in the console.
/* export logins as JSON */
signons = prompt("Logins",JSON.stringify(Services.logins.getAllLogins()));

This should give you a prompt window that allows to copy the login data to the clipboard via Ctrl+C.

======

I got this the third time I did this. I didn't realize that I needed to do a Ctrl+A and a Ctrl+C in the prompt window and the paste it into a text file/document.

======

You can paste this login data in a text file and transfer this file to the other computer via a portable USB drive.

On the other computer you can repeat the first steps and enable the command line in the Browser Console in the same way (open a developer tool and press F1 to go to settings and tick the box).

You can then open the Browser Console and paste the second part of the code to import the logins. In the prompt you can paste the content of the file where you previously saved the JSON login data.


/* import Logins from JSON */
if (logins = prompt("Array of JSON Logins",signons)){
try {
 logins = JSON.parse(logins);
 ChromeUtils.import("resource://gre/modules/LoginHelper.jsm");
 LoginHelper.maybeImportLogins(logins);
} catch(e){ console.log(e); }
}

==========

I keep getting errors when I posted this on the new computer. The "}" on the line with nothing in front of it gets an error, I think because there is a space after it in the post.

I deleted the extra space and when I put:

/* import Logins from JSON */ if (logins = prompt("Array of JSON Logins",signons)){ try {

logins = JSON.parse(logins);
ChromeUtils.import("resource://gre/modules/LoginHelper.jsm");
LoginHelper.maybeImportLogins(logins);

} catch(e){ console.log(e); } }

I got the following error

"ReferenceError: signons is not defined"

"What went wrong?

There is a non-existent variable referenced somewhere. This variable needs to be declared, or you need to make sure it is available in your current script or scope."


I don't see where I need to put the reference or file name or put all of the JSON text file.

Modified by SFSecurity

more options

Chosen Solution

Oops, yes signons isn't defined with only the import code. You can use this code or use the full code (export and import).

/* import Logins from JSON */
if (logins = prompt("Array of JSON Logins",logins||"")){
try {
 logins = JSON.parse(logins);
 var i,lg;
 for (i=0; lg=logins[i]; i++){if (!lg.origin){lg.origin = lg.hostname}}
 ChromeUtils.import("resource://gre/modules/LoginHelper.jsm");
 LoginHelper.maybeImportLogins(logins);
} catch(e){ console.log(e); }
}

It would work with the full code because that defines the var. That would also allow to backup existing logins.

/* export current logins as JSON */
logins = prompt("Logins",JSON.stringify(Services.logins.getAllLogins()));

/* import Logins from JSON */
if (logins = prompt("Array of JSON Logins",logins||"")){
try {
 logins = JSON.parse(logins);
 var i,lg;
 for (i=0; lg=logins[i]; i++){if (!lg.origin){lg.origin = lg.hostname}}
 ChromeUtils.import("resource://gre/modules/LoginHelper.jsm");
 LoginHelper.maybeImportLogins(logins);
} catch(e){ console.log(e); }
}

Modified by cor-el

more options

I have tried both versions that you suggest and get the prompt each time and added the carry-over from the old computer and hit "Okay" but nothing happens even after rebooting Firefox and the computer.

The only username/password that shows up is my current Firefox:

accounts.firefox.com

What am I doing wrong?

Modified by SFSecurity

more options

Do you see any messages in the Browser Console related to importing logins ?

You do run the JavaScript code in the Browser Console (it won't run in the Web Console) ?

Modified by cor-el

more options

Yes, I used the JavaScript code in the Browser Console and that is what got me the image in my prior reply. Still not adding usernames and passwords to Firefox on the new computer.

Modified by SFSecurity

more options

Does Firefox parse the file correctly if you give the file a .json file extension and open the file in a Firefox tab to make the builtin JSON viewer display the content ?

Modified by cor-el