in the context of automating the installation of a machine, I would like to configure firefox, specifically the proxy settings, from the command line, either by executing commands or by editing configuration files, for example.

Is this possible, and if yes how?

Edit: I forgot to mention that I would like to configure the proxy for all users.

  • man firefox should answer all your questions.
    – Panki
    Jan 23, 2019 at 7:55
  • 1
    @Panki Which part of the manual talks about configuring preferences, such as proxy settings?
    – Sparhawk
    Jan 23, 2019 at 8:26
  • 1
    @Flo Probably just easier to create a new profile from scratch, then duplicate the directory. Although maybe there are UIDs that shouldn't be shared between different systems.
    – Sparhawk
    Jan 23, 2019 at 8:27

1 Answer 1


You have basically two choices (that i can think of)

  1. Launch firefox, and update your profile with the correct settings (proxy ones for example). Then close and retrieve your configuration in ~myusername/.mozilla/firefox/xxxxxxx.default/prefs.js. xxxxx is a dynamic string. You can then use this user preferences for your deployement.
  2. Directly update that file, after you've deployed / installed a machine, with the proxy settings.

When you will launch firefox with that user, the settings will be directly applied.

According to the comment of @Sparhawk, the second option would fit better. In that case we keep the original prefs.js as intact as possible, just changing the proxy settings:

user_pref("network.proxy.http", "IPADDRESS OR URL");
user_pref("network.proxy.http_port", 8080);
  • 1
    The reason why I didn't write up my comment as an answer is because (as I hinted) I suspect (internal) UIDs should be unique. I have tried duplicating my profile from one system to another, and had odd behaviour with things like Firefox Sync.
    – Sparhawk
    Jan 23, 2019 at 9:00
  • The second option sounds good indeed. But is there a prefs.js equivalent for all users, "global" configuration so to speak?
    – Flo
    Jan 23, 2019 at 10:47
  • No, but you could also configure your proxy directly in your machine, for the whole system: in /etc/sysconfig/proxy for example.
    – jayooin
    Jan 23, 2019 at 10:59
  • @jayooin The fact that this is not possible for all users is valuable information for me. Thank you!
    – Flo
    Jan 24, 2019 at 6:22

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.