24

I run Ubuntu 14.04 and want to use one installation of Firefox with two different profiles for the same logged in Ubuntu user.

How can I set this up, so that I may easily launch both profiles from the Unity launcher?

muru
  • 197,895
  • 55
  • 485
  • 740
CatCoder
  • 659
  • 1 firefox with 2 profiles? Or 2 firefoxes with each a profile? ;) – Rinzwind Aug 11 '15 at 12:56
  • 2 firefox with separated profiles and icons that I can distinguish between them. – CatCoder Aug 11 '15 at 13:06
  • I asked cuz you can of course install another firefox from a source into /opt/, create a desktop file and add another icon to it. But the profile option as shown in the answer is probably easier (just create 2 launchers for each profile) – Rinzwind Aug 11 '15 at 13:09
  • Is one firefox icon with context menu entries to select profile also ok? If yes, which option (show profilemanager or directly load a profile) would you prefer to be the default action when simply clicking on it? – Byte Commander Aug 11 '15 at 13:13
  • I want to directly load the profile. I was able to create another profile but the terminal is open and when I close the terminal firefox with other profile will close too. – CatCoder Aug 11 '15 at 13:22
  • 3
    Now you are expanding a simple short question into a long question by adding comments in various locations. You should update your question and be more specific rather then expanding the question in the comments. This site is designed to be one question - one answer, not a detailed discussion over several comments. – Panther Aug 11 '15 at 13:22
  • 3
    @Vesal75 please edit your question with all the extra's mentioned. – Rinzwind Aug 11 '15 at 13:54
  • @Vesal75 Don't forget to accept the answer that you think is addressing your problem best and was able to solve it. Therefore click the grey tick on the left of the answer. Read the short [tour] to find out more about how AskUbuntu works. Thank you and welcome! :-) – Byte Commander Aug 11 '15 at 14:56
  • 3
    You don't need to have three Firefox installations. Simply create three different profiles, and then launch the three instances with firefox -P profilename --new-instance. You can create launchers or shortcuts for each, as well as customize each profile with themes and extensions. To create a profile, type about:profiles in the address bar, then click "Create a New Profile". – mikewhatever Jan 16 '18 at 16:45
  • 5
    Firefox 57+ has multi-account containers (enable it by installing the extension of the same name) so you don't even need profiles anymore. – Michael Hampton Jan 16 '18 at 20:47

9 Answers9

32

How to set up different Firefox profiles for the same Ubuntu user and the same Firefox installation

Excerpt of the command-line options from man firefox:

-ProfileManager
   Start the profilemanager. Use this to choose the profile you would like to
   run firefox with. You will need to also use -no-remote if there is already
   a running firefox instance.

-P profile
   Start firefox with the profile named profile. Will start the profile
   manager if a valid profile name is not specified. You will need to also
   use -no-remote if there is already a running firefox instance.

So you just need to start Firefox with one of those parameters by either using a terminal, the Alt+F2 HUD, from the launcher icon's context menu after editing its configuration file, which I will describe below.

Set up a new profile:

  • Launch Firefox's ProfileManager from the terminal or with Alt+F2:

    firefox -ProfileManager
    

    Firefox ProfileManager main window

  • Rename your current profile default to profile1 (or whatever you like, you don't even have to rename it, but I will do in this guide for clarification - you just have to replace profile1 with your exact name wherever it occurs!) by clicking on Rename Profile....

  • Create a new profile with the wizard by clicking on Create Profile.... It will show you an info window first, read it and click Next. The second window will ask you to enter a name for the profile, enter profile2 here (or replace it wherever it occurs in this guide with exactly what you entered instead). I would recommend you not to change the folder where the profile will be stored in, unless you have a good reason to do so. Click Finish.

    Firefox ProfileManager Create Profile wizard

  • Exit the ProfileManager.

Set up your launcher icon to access those profiles from the context menu:

  • Copy the original launcher file (which is owned by root, used system-wide and will get replaced with the next update) to your home folder:

    cp /usr/share/applications/firefox.desktop ~/.local/share/applications/firefox.desktop
    
  • Edit the copy e.g. with either Gedit (GUI) or Nano (terminal):

    gedit ~/.local/share/applications/firefox.desktop
    nano ~/.local/share/applications/firefox.desktop
    
  • Search for the line:

    Actions=NewWindow;NewPrivateWindow;
    

    and add new context menu action identifiers like this (example names, but only used within the file, you won't see them anywhere else):

    Actions=NewWindow;NewPrivateWindow;Profile1;Profile2;ProfileManager;
    
  • Insert the code snippet below at the end of the file, you may vary the Name= value and add as many translations as you want (example for German [de] is given). The Exec=firefox -P ... lines have to contain the exact (case-sensitive) name of the profiles you created in the profile manager! The -no-remote flag allows multiple firefox profiles to run at the same time. Also the last word in the lines [Desktop Action ...] has to exactly match the keys you added to the Actions= line above.

    [Desktop Action Profile1]
    Name=Run Firefox with profile 1
    Name[de]=Firefox mit Profil 1 starten
    Exec=firefox -P profile1 -no-remote
    OnlyShowIn=Unity;
    
    [Desktop Action Profile2]
    Name=Run Firefox with profile 2
    Name[de]=Firefox mit Profil 2 starten
    Exec=firefox -P profile2 -no-remote
    OnlyShowIn=Unity;
    
    [Desktop Action ProfileManager]
    Name=Open Firefox profile manager
    Name[de]=Firefox Profilmanager öffnen
    Exec=firefox -ProfileManager -no-remote
    OnlyShowIn=Unity;
    
  • Now if you want to specify a permanent default profile for when you left-click the launcher icon (otherwise the profile you last used through the ProfileManager with the respective checkbox ticked gets launched), you also have to edit the main Exec= line. It's the topmost and should look like this:

    Exec=firefox %u
    

    Edit it to look like the one below, maybe replacing profile1 with the correct default profile name you wish.

    Exec=firefox -P profile1 %u
    
  • You have to reboot (maybe logging out and back in is also enough?) before the system realizes that you want to override the system-wide firefox.desktop file and use your personal and customized one. Or you can use the command

    desktop-file-install --dir=~/.local/share/applications ~/.local/share/applications/firefox.desktop
    

    to re-initiate the launcher file. After that, enjoy your multiple profiles!

Byte Commander
  • 107,489
  • 4
    This is the complete solution, but missing one tiny detail. If you want to launch different profiles at the same time "-no-remote" can be used. Otherwise this is the answer I've been looking for. –  Mar 07 '18 at 10:59
22

I think Firefox Profile Switcher is your answer!

You can activate it with the option "-P" like this on the commandline

firefox -P

You can then create Profiles for each task, all in the same homefolder (if you must).

firefox profiles

To have them all running at the same time you'll also need to add --new-instance to the command.

And finally, you can select one of the predefined themes via the Customize Menu and Toolbars option :

Open the customization dialog and on the lest you'll see Themes as drop down menu.

You'll have to this for each social media account, I guess.

You can now either place an icon on the launcher that invokes

firefox -P --new-instance

or write a small wrapper script and replace the symlinks.

sudo nano /usr/local/bin/firefox

enter the following with the correct paths

#!/bin/bash
/usr/lib/firefox/firefox -P --new-instance

make it executable

sudo chmod +x /usr/local/bin/firefox

As pointed out by the user muru in the comments below, it is not necessary to replace the original link, as originally suggested

The path to the firefox link might differ on your OS, you can find it out with

which firefox

then remove the old link

sudo unlink /usr/bin/firefox

link it to the correct path

sudo ln -s /usr/local/bin/firefox /usr/bin/firefox

Robert Riedl
  • 4,351
12

I would propose the Multi-Account Containers extension, an official Mozilla-made addon. The use-case you described is precisely why it exists:

Screenshot from AMO
(source: mozilla.net)

She can create containers for each one of her account sets, and choose an accent color. This accent color will show up below the title of every tab, indicating which container it is on:

Three tabs on three containers (nevermind the dark theme)

Tabs by default do not open in a container, you create them by long-pressing the "new tab" button.

Not only are the containers easily identified, tabs are just normal tabs, you can put them all on the same window. (with multiple profiles, you would not be able to have tabs of 2 profiles in one window).

Additionally, the browser configuration and installed plugins are still the same (since it is just one browser), which reduces the "WTF" factor.

Glorfindel
  • 971
  • 3
  • 13
  • 20
Kroltan
  • 376
  • 1
  • 4
  • 13
2

Run firefox -P or firefox -ProfileManager.

You may then create, select, and manage your profile(s).

ff profile

See also How to create a new Firefox profile on Windows? (kb.mozillazine.org).

I could not find a similar page for Linux, but the options and screens are nearly the same.

To create an icon, create a desktop file as described in How to get my custom .desktop file into the unity launcher? (askubuntu.com)

Use firefox -P YOURPROFILENAME to start Firefox with the given profile.

You may find more info about Firefox's command-line parameters by reading its manpage (type man firefox in terminal).

Panther
  • 102,067
1

Same as above, and if interested in learning why one should/could have several profiles, the following link has some additional information:

Multiple Firefox Profiles

Starting Profile Manager in Linux

If Firefox is already included in your Linux distribution or if you have installed Firefox with the package manager of your Linux distribution:

"At the top of the Firefox window, click on the File menu and select Quit. In Terminal run: firefox --ProfileManager

If the Profile Manager window does not open, Firefox may have been running in the background, even though it was not visible. Close all instances of Firefox or restart the computer and then try again."

impalle
  • 177
1

I will add this in case you want 2 firefoxes. The end result will be a normal firefox and one installed in /opt/. Both can be started at the same time and are totally separated from each other.

  • Download the source file for a version of firefox. Possibly from here.
  • Go to a terminal and execute (I assume you have 1(!) downloaded tar file; change the "*" to the actual version if you have 2) and will start a 2nd instance of firefox from a terminal:

    cd /opt/ && sudo tar xjf ~/Downloads/firefox-*.tar.bz2
    cd firefox
    ./firefox
    
  • Closing the terminal will also close firefox.

  • Create a new launcher. See How can I create launchers on my desktop? on how to do that. Or copy the normal firefox launcher (see /usr/share/applications) to a new name and edit it to start this version. If you change the icon you also get a different icon on the launcher.
Rinzwind
  • 299,756
0

In a terminal type

firefox -no-remote -ProfileManager

and create a new profile. Then start the desire profile with

firefox -P profilename
Byte Commander
  • 107,489
FelixJN
  • 2,358
0

The easiest way to manage profiles in firefox is installing the multifox addon.

URL: https://addons.mozilla.org/en-US/firefox/addon/multifox/

It works like profiles in Chrome but more smooth and better.
You can open up different tabs of the same site with different logged in users.

See attached:
enter image description here

Parto
  • 15,325
  • 24
  • 86
  • 117
-1

You can open a new private window in Firefox (much like Chrome's incognito window) and use it simultaneously with normal browser with different accounts.

NavalRishi
  • 36
  • 1
  • 8
  • 1
    so each time I shutdown my computer I have to enter all those pass and usernames. – CatCoder Aug 11 '15 at 14:05
  • Works e.g. to log into one site with two accounts simultaneously once in a while, because private windows don't share cookies, cache, etc. but is not useful if you want to save passwords, have history, have different add-ons, settings, designs,... – Byte Commander Aug 11 '15 at 14:41