My Firefox Setup

linux
firefox
_blog
Published

August 9, 2023

Multiple Profiles

So Mozilla, the company behind the Firefox web browser, offers a feature called Firefox sync. It enables you to sync your firefox browser, with your mozilla account, to any device.

However, it has a caveat: it can only sync one firefox profile. Firefox profiles, are basically completely different instances on firefox, capable of having every single thing be seperate, down to things like advanced settings.

Generally, what is recommended to do to seperate accounts, is to use firefox multi account containers. These seperates cookies and logins between sites. This lets people protect their privacy, because sites like Facebook can no longer snoop to see what other sites have also given you a facebook cookie.

However, I found multi account containers very frustrating to use. If you are trying to manage multiple accounts on the same site, on a site that doesn’t let you do that natively (google/gmail do, but microsoft doesn’t), it constantly asks you if you are sure that you want to open this site in this container. In addition to that, it does that for other sites as well, like google search, which makes it very frustrating.

Firefox profiles, don’t have that annoyance, but I also enjoy the greater degree of seperation they give. Because each firefox profile can have completely differenct settings, this means that I can do things like configure one firefox profile for performance, but at the cost of stability. However, my schoolwork profile is configured never to crash, because it needs to be reliable. Multi account containers can’t do that.

Default Applications

Because I use multiple profiles, I would like the option to chose what link each firefox profile opens in.

So far, I’ve tried this command xdg-settings set default-web-browser none.desktop, with the goal of a “choose application” screen appearing that then lets me run firefox -p profilename to open a websit ein a specific profile, but it didn’t work.

I would like to try some further stuff, but if it doesn’t work out, I can just default to the “play” profile which is my profile for personal use and the like

Syncthing

Because I can’t use the native firefox profiles to sync, I had to find other solutions. Originally, I used the graphical frontend for rsync, Grsync, syncing into a usb drive, into the computer, and vice versa, to sync between computers. However, this was extremely slow, because apparently usb flash drive’s suck at transferring many small files.

I later switched to another solution, syncthing. Syncthing can keep folders of two computers synchronized, from anywhere in the world.

But it wasn’t perfect at first. In order to get it to work properly, I had to add the proper firewall rules. Onlydid after this did syncing work.

Another issue I had with it was that it synced the cookies file of firefox. Cookies, are where most sites store the session tokens, a common way of knowing that you are logged in on this device. However, session tokens also present a security risk. All an attacker needs to get access to the login of a site is a session token (stored in the cookies.sqlite file for firefox), which is often stored unencrypted, in areas the currently logged in user can read and write to. (see session hijacking)

Because my session tokens were being transfered to another machine, google and some other services thought I was getting hacked, and forced me to do lot’s of confirmations, and “yes it’s me.” Annoying, but a reasonable security measure.

So I had to configure syncthing to not sync certain files.

*cookies.sqlite*.

This partical glob match will exclude firefox’s cookies.sqlite file, and the cookies.sqlite-wal file, which is a journaling file. In computer filesystems, journals record changes that are going to be made to other files or the filesystem before they are made, in order to make data recovery from an abrupt stop, like a crash possible. If the journal is complete, then the computer can simply finish the changes by reading the journal. If the journal is incomplete, then the computer can simply not make the changes, as having an intact cookies.sqlite file is more important than a cookie or two.

Finally, you cannot have both firefox instances running at once. This will cause syncthing to get confused, as it is attempting to make the most recent version of the file propogate, but both computers have the most recent version.

This let to the creation of lots of .sync-conflict files, and firefox giving me a warning: The bookmarks and history system will not be functional. I tried deleting the sync conflict files, but nothing changed.

I ended up having to manually repair that firefox profile, by creating a new one and copying the important data over

One more thing, made later: You can’t quit firefox with cntrl+q, as this will sometimes leave an unsyncable file. You have to close firefox from the desktop UI, I usually just use KDE Plasma to close everything at once.