Skip to content

Instantly share code, notes, and snippets.

@leifj
Last active January 4, 2023 18:08
Show Gist options
  • Select an option

  • Save leifj/faad4e82fffb1bc4acaf7c1846f1f886 to your computer and use it in GitHub Desktop.

Select an option

Save leifj/faad4e82fffb1bc4acaf7c1846f1f886 to your computer and use it in GitHub Desktop.
A simple cmdline to set firefox config in all profiles found in $HOME/.mozilla/firefox - useful to disable TRR
#!/bin/bash
#
# https://blog.ungleich.ch/en-us/cms/blog/2018/08/04/mozillas-new-dns-resolution-is-dangerous/
# https://askubuntu.com/questions/313483/how-do-i-change-firefoxs-aboutconfig-from-a-shell-script
#
# To completely disable sending your DNS queries to cloudflare:
#
# ff_set network.trr.mode 5
#
for profile in `find $HOME/.mozilla/firefox -maxdepth 1 -type d -name \*.default`; do
if [ -f $profile/prefs.js ]; then
echo "Setting option $* in $profile/prefs.js"
sed -i 's/user_pref("'$1'",.*);/user_pref("'$1'",'$2');/' $profile/prefs.js
grep -q $1 $profile/prefs.js || echo "user_pref(\"$1\",$2);" >> $profile/prefs.js
fi
done
@marcocspc
Copy link

Hi! I've made a fork of your script and modified a few lines to make it work with firefox snap. Since I cannot make pull requests on a gist, I'm just commenting here so if you want, you can update your version.

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