Enable Firefox network partitioning
- Linux onlyThis script improves your privacy on Linux
- Single actionThis page belongs to a script, containing basic changes to achieve a task.
- Impact: Minimum
System Functionality / Data Loss Risk: Low
This action improves privacy with minimal impact when you run the recommended script.
- Bash (Shell script)These changes use Linux system commands to update your settings.
- Sudo/root requiredThis script requires privilege access to do the system changes
- Fully reversible
You can fully restore this action (revert back to the original behavior) using this website.
The restore/revert methods provided here can help you fix issues.
Overview
Network partitioning is a method used by Firefox to enhance user privacy 1. When enabled, each website you visit has its own isolated storage location, preventing it from accessing data from another website 1. This limits the ability of websites to track users across multiple sites 1.
Network Partitioning, formerly referred to as cache partitioning 2, is a subset of state partitioning 1. While state partitioning deals with data like cookies, network partitioning deals with networking-related components, such as caches and connection pools 1. It ensures that these components are isolated to each website, further enhancing user privacy 1.
Firefox has enabled network partitioning by default since version 85 1. Once enabled, network partitioning becomes permanent, meaning websites cannot bypass or weaken its restrictions 1.
Network partitioning can be controlled with the privacy.partition.network_state
preference 1.
Sources
- State Partitioning - Privacy on the web. MDN. (2023).
Original: https://developer.mozilla.org/en-US/docs/Web/Privacy/State_Partitioning
Archived: https://web.archive.org/web/20230918172155/https://developer.mozilla.org/en-US/docs/Web/Privacy/State_Partitioning - 1687569 - cache partitioning causes web page saving extensions to waste more time and data. bugzilla.mozilla.org. (2023).
Original: https://bugzilla.mozilla.org/show_bug.cgi
Archived: https://web.archive.org/web/20231003094417/https://bugzilla.mozilla.org/show_bug.cgi?id=1687569
Apply Now
Choose one of three ways to apply:
Help
How to apply or restore "Enable Firefox network partitioning" using script
- ≈ 3 min to complete
- Tools: Web Browser
- Difficulty: Medium
- ≈ 5 instructions
- 1
Download
Download the script file by clicking on thebutton above.
Use button above to restore changes. - 2
Keep the file
If warned by your browser, keep the file. - 3
Open
Open the downloaded file. - 4
Exit
Once it's done, press any key to exit the window. - 5
Restart
Restart your computer for all changes to take effect.
Apply with privacy.sexy
Guided, automated application with safety checks- Recommended for most users
- Includes safety checks
- Free
- Open-source
- Popular
- Offline/Online usage
Help
How to apply or restore "Enable Firefox network partitioning" using privacy.sexy
- ≈ 3 min to complete
- Tools: privacy.sexy
- Difficulty: Simple
- ≈ 4 instructions
- 2
Choose script
- Search for the script name: Enable Firefox network partitioning
- Check the script by clicking on the checkbox.
- 3
Run
Click on ▶️ Run button at the bottom of the page.This button only appears on desktop version (recommended). On browser, use 💾 Save button.
- Apply
- Revert
pref_name='privacy.partition.network_state'
pref_value='true'
echo "Setting preference \"$pref_name\" to \"$pref_value\"."
declare -a profile_paths=(
~/.mozilla/firefox/*/
~/.var/app/org.mozilla.firefox/.mozilla/firefox/*/
~/snap/firefox/common/.mozilla/firefox/*/
)
declare -i total_profiles_found=0
for profile_dir in "${profile_paths[@]}"; do
if [ ! -d "$profile_dir" ]; then
continue
fi
if [[ ! "$(basename "$profile_dir")" =~ ^[a-z0-9]{8}\..+ ]]; then
continue # Not a profile folder
fi
((total_profiles_found++))
user_js_file="${profile_dir}user.js"
echo "$user_js_file:"
if [ ! -f "$user_js_file" ]; then
touch "$user_js_file"
echo $'\t''Created new user.js file'
fi
pref_start="user_pref(\"$pref_name\","
pref_line="user_pref(\"$pref_name\", $pref_value);"
if ! grep --quiet "^$pref_start" "${user_js_file}"; then
echo -n $'\n'"$pref_line" >> "$user_js_file"
echo $'\t'"Successfully added a new preference in $user_js_file."
elif grep --quiet "^$pref_line$" "$user_js_file"; then
echo $'\t'"Skipping, preference is already set as expected in $user_js_file."
else
sed --in-place "/^$pref_start/c\\$pref_line" "$user_js_file"
echo $'\t'"Successfully replaced the existing incorrect preference in $user_js_file."
fi
done
if [ "$total_profiles_found" -eq 0 ]; then
echo 'No profile folders are found, no changes are made.'
else
echo "Successfully verified preferences in $total_profiles_found profiles."
fi
InByZWZfbmFtZT0ncHJpdmFjeS5wYXJ0aXRpb24ubmV0d29ya19zdGF0ZSdcbnByZWZfdmFsdWU9J3RydWUnXG5lY2hvIFwiUmV2ZXJ0aW5nIHByZWZlcmVuY2U6IFxcXCIkcHJlZ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VcbiAgICAgIGVjaG8gJCdcXHQnJ1NraXBwaW5nLCB0aGUgcHJlZmVyZW5jZSBoYXMgdmFsdWUgdGhhdCBpcyBub3QgY29uZmlndXJlZCBieSBwcml2YWN5LnNleHkuJ1xuICAgIGZpXG4gIGRvbmVcbmRvbmVcbmlmIFsgXCIkdG90YWxfcHJvZmlsZXNfZm91bmRcIiAtZXEgMCBdOyB0aGVuXG4gIGVjaG8gJ05vIHJldmVyc2lvbiB3YXMgbmVjZXNzYXJ5LidcbmVsc2VcbiAgZWNobyBcIlN1Y2Nlc3NmdWxseSB2ZXJpZmllZCBwcmVmZXJlbmNlcyBpbiAkdG90YWxfcHJvZmlsZXNfZm91bmQgcHJvZmlsZXMuXCJcbmZpIg==
Help
How to apply or restore "Enable Firefox network partitioning" using commands
- ≈ 2 min to complete
- Tools: Terminal
- Difficulty: Medium
- ≈ 3 instructions
- 1
Open terminal
Open your terminal application. - 2
Copy code
Copy the code: - 3
Paste & run
Paste the commands into terminal application and press Enter to run.Some changes require a system restart to take effect
Similar Guides
Wider Goal
Guides below includes this guide to achieve a wider goal.See other more general settings that includes this one as one of its actions.
These plans combine multiple privacy settings, including this one, for stronger protection.
- Enable Firefox state partitioning (Total Cookie Protection)
- Harden Firefox privacy
- Configure Firefox
- Configure programs
Web browsers, including Firefox, save various data types such as cookies, cache, and site-specific details. While this data helps in providing a faster and persona...
The following are privacy-focused tweaks to prevent browser fingerprinting and tracking. See also: What is browser fingerprinting? | AmIUnique.org
Mozilla Firefox, colloquially known as Firefox, is a free and open-source web browser created by the Mozilla Foundation and its subsidiary, the Mozilla Corporation...
These scripts configure third-party applications installed on Linux distributions to harden their security and privacy to protect your data. They scripts differ fr...
Same Goal
Other guides in Enable Firefox state partitioning (Total Cookie Protection)See settings that are in the same category as this guide.
Using other actions in the same category may help you achieve your goal better.
About the Creators
These people have authored this documentation and written its scripts:
Reviewed By
This guide has undergone comprehensive auditing and peer review:Expert review by undergroundwires
- Verified technical accuracy and editorial standards
- Assessed system impact and user privacy risks
Public review by large community
- Privacy enthusiasts and professionals peer-reviewed
- Millions of end-users tested across different environments
History
We continually monitor our guides, their impact and all other privacy options. We update our guides when new information becomes available. On every update, we publicly store who made the change, what has been changed, why the change was made and when the change was made.