I am trying to configure firefox from a script. I have already hit a wall establishing the deafault homepage.

Found some old info what does not work anymore: echo "user_pref("browser.startup.homepage", "https://www.google.com");" >> /etc/xul-ext/ubufox.js

Digging a little, I found the xulrunner directory is now /usr/lib64/xulrunner, but nor there nor in the firefox directory I can found a configuration file.

Does anyone know where is it?


This is stored in the user's ~/.mozilla/firefox/PROFILE_NAME.default/prefs.js file:

$ grep browser.startup.homepage .mozilla/firefox/0prxyjky.default/prefs.js
user_pref("browser.startup.homepage", "http://foobar.com");

The profile name will be different for all users but should always end with .default.

If you want to change this for all new users that will be added, you can edit /etc/skel/.mozilla/firefox/mwad0hks.default/prefs.js which is the template file for new profiles. I am not sure if the mwad0hks.default will be the same on all systems, but you should have something with an equivalent name there.

  • Just loeked up /etc/skel/.mozilla directory and there is no firefox, only extensions and plugins directorys. Strange, so wgere do I have to look if I want to change all profiles? – NotFromBrooklyn Oct 6 '13 at 18:01
  • 1
    mwad0hks is a randomly generated string. You can remove it (the “security” reason for having it is silly). You need to record the profile location in ~/.mozilla/firefox/profiles.ini. If a directory you need doesn't exist under /etc/skel, just create it. @NotFromBrooklyn – Gilles Oct 6 '13 at 20:45
  • But if the folder is not there, from which file was my profile created?, because I'm using firefox right now. – NotFromBrooklyn Oct 7 '13 at 5:52
  • But how do I replace the value? Would it be something like grep browser.startup.homepage ~/.mozilla/firefox/*.default/prefs.js | awk '{print $2}' | sed '1 s/\"*www*\"/\"www.google.com\"/' ? – Arturo Apr 16 '17 at 16:12
  • @Arturo just open the file on a text editor and make the change. Or do you want to do it to multiple profiles? – terdon Apr 16 '17 at 16:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.