Compartmentalization with Firefox Profiles
2021 June 5
Compartmentalization is good.
Firefox has a great add-on called Firefox Multi-Account Containers which is useful for compartmentalizing accounts in one browser. (This add-on seems to have been integrated directly into Firefox 89.) You can use it to isolate cookies and use multiple accounts in the same Firefox browser.
However, your browser fingerprint and all your settings will be the same regardless of which "container" you're using. This is a useful tool for some purposes, but it doesn't help with privacy or customizability to the degree that using different browsers for different purposes would.
Some people recommend using multiple web browsers to compartmentalize. This is good advice, but it means you must have multiple browsers installed. (Plus, most popular browsers are non-free and privacy-hostile, so depending on your needs, it can be a lot of work to find enough different browsers that work for you and aren't terrible. I would certainly never recommend using Google Chrome for any purpose.)
Introducing profiles
You don't need multiple browsers. You can have multiple configurations of Firefox (or other Firefox-based browsers) using a tool called profiles. Each profile has its own configuration.
Want to accept cookies when you use social media but reject cookies when you're browsing the web? Great, just make a "social" profile with cookies enabled and a "browsing" profile with cookies disabled.
Want to enable privacy.resistFingerprinting, but it breaks one of the sites you need to use for work? Disable RFP in your work profile and enable it in your other profile(s).
Want to use an HTTP or SOCKS proxy for only some traffic? Just use profiles with different proxy settings.
Profiles are a great tool for compartmentalizing without having to deal with installing lots of browsers.
I do recommend using Tor Browser for Tor stuff and a different browser (like Firefox) for clearnet stuff (when you must). There are lots of good reasons to have different browsers for different purposes. But I think people tend to leap to multiple browsers for compartmentalization because they just don't realize profiles are an option.
Using profiles from within the browser
If you have Firefox (et al) open, you can go to about:profiles to view your profiles, create a new one, launch a different one, and so on.
Using profiles from the command line
If you don't have Firefox (et al) open, you can run it from the command line with the -P (that's a capital P) flag:
firefox -P
This will open a dialogue asking which profile you want to use. You can add and modify profiles in this menu.
To launch Firefox using a specific profile, specify the profile name after -P:
firefox -P <profile name>
Be aware that by default, you can't have multiple instances of Firefox running simultaneously. We can easily work around this with the --no-remote argument:
firefox -P <profile name> --no-remote
Setting up shortcuts
I like to set up keyboard shortcuts to launch different profiles. I don't have a per-desktop-environment guide for how to do this, but here's how I do it on Xfce:
- Launch the Xfce Keyboard settings. (This can be found in the Xfce Settings Manager.)
- Go to the Application Shortcuts tab.
- Click Add (which has a plus symbol icon).
- Enter "firefox -P browsing --no-remote" as the command, replacing "browsing" with the name of your profile.
- Press OK.
- Press the keys you want to use to launch that Firefox profile.
- Repeat with each profile you want to be able to launch easily.
(Also replace "firefox" with the command to launch your browser if you use a different Firefox-based browser.)
For example, I like to use the "super" key along with a number key, where different numbers launch different browser profiles. Maybe super+1 launches your default profile, and other key combos launch other profiles.
Profile files
Profiles are stored by default in ~/.mozilla/firefox/ in a folder with a name that ends in the name of the profile. (For example, a profile called "accounts" might be located at ~/.mozilla/firefox/fn18ahl8.accounts.)
Apparently, on Windows, they're stored in the C:\Users\<your username>\AppData\Roaming\Mozilla\Firefox\Profiles\ folder.