How can I set the default search engine for Firefox without the GUI on Linux?

I want to automate the setup of Firefox on Linux, to harden it and change the default search engine. You can almost edit all configuration options via the user.js file, but not the default search engine setting.

Is there a way to do it programmatically?


Solution 1:

Setting the default search engine is too malware prone and cant be accomplished except through group policies in Windows, or for Linux through something called Enterprise Policy Engine which is available for Firefox.

This works through an addon called Enterprise Policy Generator and the use of a policies.json file. Both links will set you on your way to make use of the enterprise policy engine.

In your policies.json file, the following lines allow you to define the default search engine:

{
  "policies": {
    "SearchEngines": {
      "Default": "NAME_OF_SEARCH_ENGINE"
    }
  }
}