Skip to content

Instantly share code, notes, and snippets.

@msanders
Last active March 13, 2024 01:58
Show Gist options
  • Save msanders/57837aaf6f7da30dcc1eb0bdf6b0b733 to your computer and use it in GitHub Desktop.
Save msanders/57837aaf6f7da30dcc1eb0bdf6b0b733 to your computer and use it in GitHub Desktop.
Backup and restore cookie and site exception list in Firefox

Installation

mkdir -p ~/bin
curl --proto "=https" --tlsv1.2 https://gist.githubusercontent.com/msanders/57837aaf6f7da30dcc1eb0bdf6b0b733/raw/firefox_export_cookie_exceptions > ~/bin/firefox_export_cookie_exceptions
curl --proto "=https" --tlsv1.2 https://gist.githubusercontent.com/msanders/57837aaf6f7da30dcc1eb0bdf6b0b733/raw/firefox_restore_cookie_exceptions > ~/bin/firefox_restore_cookie_exceptions
chmod u+x ~/bin/firefox_export_cookie_exceptions  ~/bin/firefox_restore_cookie_exceptions 
mkdir -p ~/.local/share/fxcookies

# NOTE: Firefox must be closed in order for restore to unlock the database.
# https://kb.mozillazine.org/Profile_folder_-_Firefox#Finding_the_profile_folder
~/bin/firefox_export_cookie_exceptions /path/to/fxprofile > ~/.local/share/fxcookies/exceptions.txt
~/bin/firefox_restore_cookie_exceptions /path/to/fxprofile ~/.local/share/fxcookies/exceptions.txt

License

Copyright Michael Sanders.

This work is licensed under the terms of the MIT license. For a copy, see https://opensource.org/licenses/MIT.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment