Cookies in Firefox ================== Author: Momchil Ivanov Date : 2014.02.02 Introduction ------------ This article contains notes on the web browser Firefox. The following applies to Firefox as of ESR Version 17.0.8. Database -------- The cookies database is a SQLite database located in the directory of the Firefox profile. The location of the file is: $HOME/.mozilla/firefox//cookies.sqlite The profile id usually ends with ".default", therefore the file can be accessed using shell expansion: $HOME/.mozilla/firefox/*.default/cookies.sqlite The contents of the database can be accessed using SQLite: $ sqlite3 $HOME/.mozilla/firefox/*.default/cookies.sqlite sqlite> .tables moz_cookies sqlite> .schema moz_cookies CREATE TABLE moz_cookies (id INTEGER PRIMARY KEY, name TEXT, value TEXT, host TEXT, path TEXT,expiry INTEGER, lastAccessed INTEGER, isSecure INTEGER, isHttpOnly INTEGER, baseDomain TEXT, creationTime INTEGER); CREATE INDEX moz_basedomain ON moz_cookies (baseDomain); CREATE UNIQUE INDEX moz_uniqueid ON moz_cookies (name, host, path); sqlite> .exit There is one table calles "moz_cookies" that contains all the cookies. The information contained for each cookies is: - id - name - value - host - path - expiry - lastAccessed - isSecure - isHttpOnly - baseDomain - creationTime How to copy cookies ------------------- One can use sqlite to copy cookies accross different Firefox profiles or different instances of Firefox. To copy the cookies from the domain "xaxo.eu" you can use: $ sqlite3 /cookies.sqlite < /tmp/dump.sql .mode insert select * from moz_cookies where baseDomain='xaxo.eu'; EOF Delete the cookies from the other profile: $ sqlite3 /cookies.sqlite 'delete from moz_cookies where baseDomain="xaxo.eu";' Insert the cookies in the other profile: $ sqlite3 < /tmp/dump.sql How to backup cookies --------------------- See "How to copy cookies".