Using Firefox profiles

Out of the box, all your Firefox windows share resources between them. Even with so-called “private browsing” enabled, a lot of what you do is shared between your Firefox tabs and windows. I often want to be logged into Amazon AWS in several different accounts at once, but even if I do that in different tabs or even in different windows of the same browser profile, I can only use one account at a time. All the windows and tabs magically track the most recent login. The answer is to use more than one profile.

Actually there is another answer of course. You could use a different browser for each purpose; Chrome for this,  Firefox for that, Opera for the other. But there are only so many browsers, and it’s confusing using different ones.

So I have a different Firefox profile for each of the AWS accounts I need to manage, another one for each bank I use, and so on. It’s very easy to set up new profiles; it takes few minutes, but the payoff is worth it. You get to use your favourite browser for everything, and things don’t get in each other’s way.

Step 1: Start the Profile Manager

Different operating system interfaces provide different ways to start the Profile Manager, but regardless of operating system you are using, it is always possible to start it on the command line like this:

firefox -P --no-remote

The “–no-remote” option makes sure that it doesn’t try to connect to any currently running instance of Firefox.

The Profile Manager will show you a list of the current profiles. There will only be one, called “default”, the first time you do this.

If there is more than one profile, make a note of which profile is selected as the default, so that you can set it as the default again later on.

Step 2: Create a new profile

In the Profile Manager, click the “Create Profile…” button, then “Next”, and enter a name for your new profile. For the purposes of this post, let’s call it “My Profile”.

It’s a good idea to keep profile names simple. Although the example profile names does have a space, it’s generally best to avoid spaces, punctuation marks or any special characters.

You can also stipulate where the new profile’s settings will be saved, by clicking the “Choose Folder…” button. Unless you have a very good reason to do otherwise, and know exactly what you are doing, I strongly suggest you leave your profile with all the others in the default location.

Click “Finish”

Step 3: Exit the Profile manager

You should see your new profile “My Profile” highlighted in the list of profiles. Scroll through the list and highlight the profile that you made a note of in Step 1. This will make sure that your usual default profile remains the default.

Below the list of profiles are two checkboxes. Make sure that “Work offline” is NOT checked.

Leave the other checkbox checked (“Use the selected profile without asking at startup”).

Click “Exit”.

Step 4: Use your new profile

Exactly how you do this will vary from operating system to operating system, but from the command line it is the same on all (or at least, it’s the same on Windows and Linux, and probably on MacOS):

firefox -P "My Profile"

The “-P” option will cause Firefox to start up using the named profile instead of the default. Notice how the profile name is wrapped in double quotes – they are needed only if the profile name contains spaces.

You can optionally integrate this command with the windows manager of your choice (or set up a shortcut or whatever in Windows). Here is another post that explains how to do that in Ubuntu Unity.

Step 5: Customise your profile

Your profile is like a fresh copy of Firefox – you will have to add your favourite extensions and add-ons, and set up the preferences to your satisfaction.

In particular, make sure your privacy and security options are set correctly.

Step 6: Rinse and repeat!

You can create as many profiles as you like.

You can use the Profile Manager to delete any profiles that you no longer need, or to rename them if necessary.

A totally other method

If there is a problem with profiles, it is that they are a bit like completely separate browsers – you have to configure each one individually! This can be a bit wearisome if you have a lot of profiles.

A partial workaround is to create new profiles a different way – first create a copy of the default profile, the customise it, then create all other profiles by copying the customised profile. It’s only a partial workaround because any changes you need later will still have to be made to all the different profiles separately.

Firefox profiles are stored in a directory called ~/.mozilla/firefox, along with a file called profiles.ini. Each profile is actually a subdirectory containing a few dozen files. profiles.ini maps the names of profiles to their subdirectory names.

To copy a profile, you copy its directory to a new name (but still in ~/.mozilla/firefox), then add a suitable entry to profiles.ini. The details are left as an exercise for the reader.

The Profile Manager remains the easiest way to create new profiles if you don’t want them based on a customised profile. And the Profile Manager is also the easiest way to rename or remove profiles. It would have been nice if Mozilla had provided a “Copy Profile” option too…

Leave a Reply

Your email address will not be published. Required fields are marked *