Firefox configuration from command line: edit, change, copy, migrate or backupBy neokrates, written on April 27, 2010
Sometimes you only have a terminal access on the target system, but Firefox still needs to be properly configured (maybe you create automatic test environment). So, you have one source system, where you can configure Firefox visually and one fresh headless (at least for you) unix system.
Should also work with:
Any OS with Firefox (shell commands might be different though)
Most of the standard config settings are stored in your ~/.mozilla/firefox/$YOUR_PROFILE/prefs.js. So, configuration changes can be done directly.
The only problem is that it is error-prone to type all of it manually. That is why you can just tune your config on the source system and then just copy it.
Source and destination Firefox profiles
Make sure that you can access the active firefox profiles on source and destination systems.
type: vim ~/.mozilla/firefox/$YOUR_PROFILE/prefs.js on both systems (if your have many profiles, the active one is normally in ~/.mozilla/firefox/ profiles.ini)
You will see smth. like:
# Mozilla User Preferences .. user_pref("accessibility.typeaheadfind.flashBar", 0); user_pref("app.update.lastUpdateTime.addon-background-update-timer", 1272354540); ..
If Firefox on target system has no profiles just yet, make one:
firefox -CreateProfile $YOUR_PROFILE
How to copy some settings
Sometimes, only particular settings need to be copied (example: proxy settings). To do that store the original copy of prefs.js from the source system. Then, try to change the setting you are interested in in the firefox GUI. Firefox will store your setting in the prefs.js. By comparing stored and updated versions of prefs.js you can find the settings you seek.
If you want to copy all config
Archive the source ~/.mozilla/firefox/
zip -r sourceFirefoxConf.zip __~/.mozilla/firefox/__
Backup and remove the target ~/.mozilla/firefox/
Extract settings for target
Unzip, put under ~/.mozilla/firefox/ and make sure the user, which starts firefox also is the owner of ~/.mozilla/firefox/:
On target system
chown $FFOX_USER:$FFOX_GROUP -R ~/.mozilla/firefox/
If you want to backup and restore later
Backup into /your/backup/dir:
mkdir -p /your/backup/dir zip -r /your/backup/dir/backupFirefoxConf.zip ~/.mozilla/firefox/
You can unzip and replace later Firefox config versions with backup whenever you want.
LEARN MORE (amazon bookstore)