Enable dynamic First-Party Isolation (dFPI)
Overview
This script improves your privacy on Linux.
These changes use Linux system commands to update your settings.
Dynamic First-Party Isolation, also known as dFPI, is an advanced privacy feature in Firefox. This feature commonly referred to as:
Essentially, dFPI is an enhanced version of a previous privacy tool known as First-Party Isolation (FPI) 4.
The primary purpose of dFPI is to improve user privacy online. It accomplishes this by preventing third-party websites from accessing or tracking a user's data across different websites 1 3.
By default, this feature is activated for all Firefox desktop users 5.
Within Firefox's settings, there's an option called network.cookie.cookieBehavior
which governs how dFPI operates.
This setting has three potential values 3:
5
: The browser will block known trackers and partition storage for third-party content.4
: Only known trackers will be blocked without any partitioning of third-party storage.0
: All trackers and third-party content are allowed.
This script sets the value to 5
, ensuring the highest level of privacy by blocking trackers and partitioning third-party
storage. This aligns with recommended privacy practices because even if you choose the 4
value, the older First-Party
Isolation (FPI) will still be active 6.
This script uses Bash (Shell script) scripting language.
This script is recommended for all users. It helps to improve privacy without affecting stability.
Implementation Details
-
Language: bash
-
Required Privileges: Root/sudo access
-
Compatibility: Linux only
-
Reversibility: Can be undone using provided revert script
Explore Categories
- Enable Firefox state partitioning (Total Cookie Protection)
- Harden Firefox privacy
- Configure Firefox
- Configure programs
This action belongs to Enable Firefox state partitioning (Total Cookie Protection) category. 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 personalized browsing experience, it can be exploited by websites to track your activities across the internet, potentially compromising... Read more on category page ▶
This action belongs to Harden Firefox privacy category. The following are privacy-focused tweaks to prevent browser fingerprinting and tracking. See also: What is browser fingerprinting? | AmIUnique.org Read more on category page ▶
This action belongs to Configure Firefox category. 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. By default, Firefox collects telemetry data and has other features that gather information about your downloaded files and browsed... Read more on category page ▶
This action belongs to Configure programs category. These scripts configure third-party applications installed on Linux distributions to harden their security and privacy to protect your data. They scripts differ from OS level configurations as they configure applications that are not typically native to Linux distributions, i.e., not included in... Read more on category page ▶
Apply now
Choose one of three ways to apply:
- Automatically via privacy.sexy: The easiest and safest option.
- Manually by downloading: Requires downloading a file.
- Manually by copying: Advanced flexibility.
Alternative 1. Apply with Privacy.sexy
privacy.sexy is free and open-source application that lets securely apply this action easily.
You can fully restore this action (revert back to the original behavior) using the application.
privacy.sexy instructions
- Open or download the desktop application
- Search for the script name:
Enable dynamic First-Party Isolation (dFPI)
. - Check the script by clicking on the checkbox.
- Click on Run button at the bottom of the page.
Alternative 2. Download
This script is irreversible, meaning there is no straightforward method to restore changes once applied. Exercise caution before running, restoring it may not be possible.
-
Download the script file by clicking on the button below:
-
Run the script file by clicking on it.
Download revert script
This file restores your system to its original state, before this script is applied.
Alternative 3. Copy
This is for advanced users. Consider automatically applying or downloading the script for simpler way.
-
Open Terminal
-
Copy the following code:
pref_name='network.cookie.cookieBehavior'
pref_value='5'
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
- Paste the code into terminal.
- Press Enter to apply the code.
Some scripts requires restarting your computer to take affect.
Copy restore code
Copy and run the following code to restore changes:
pref_name='network.cookie.cookieBehavior'
pref_value='5'
echo "Reverting preference: \"$pref_name\" to its default."
if command -v 'ps' &> /dev/null && ps aux | grep -i "[f]irefox" > /dev/null; then
>&2 echo -e "\e[33mWarning: Firefox is currently running. Please close Firefox before executing the revert script to ensure changes are applied effectively.\e[0m"
fi
declare -a files_to_modify=('prefs.js' 'user.js')
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++))
for file_to_modify in "${files_to_modify[@]}"; do
config_file_path="${profile_dir}${file_to_modify}"
if [ ! -f "$config_file_path" ]; then
continue
fi
echo "$config_file_path:"
pref_start="user_pref(\"$pref_name\","
pref_line="user_pref(\"$pref_name\", $pref_value);"
if ! grep --quiet "^$pref_start" "${config_file_path}"; then
echo $'\t''Skipping, preference was not configured before.'
elif grep --quiet "^$pref_line$" "${config_file_path}"; then
sed --in-place "/^$pref_line/d" "$config_file_path"
echo $'\t''Successfully reverted preference to default.'
if ! grep --quiet '[^[:space:]]' "$config_file_path"; then
rm "$config_file_path"
echo $'\t'"Removed the file as it became empty."
fi
else
echo $'\t''Skipping, the preference has value that is not configured by privacy.sexy.'
fi
done
done
if [ "$total_profiles_found" -eq 0 ]; then
echo 'No reversion was necessary.'
else
echo "Successfully verified preferences in $total_profiles_found profiles."
fi
Support
This website relies on your support.
Your donation helps keep the project alive and improves its content ❤️.
Share this page: