Situation: In web development I need to be logged into an application as an administrator, normal user, unauthenticated user etc. I'd like to have a set up where each browser window is unaware of the other's logged in session.

Question: How can I have multiple browser windows open but have them running from different profiles or different cache areas? If firefox profiles, how can I achieve this without using the Profile editor UI?

Can I create a temporary user, run Firefox, then just throw away the entirety of that user account? Or, should I be using like a browser-in-a-VM?

What I've tried so far:


My first attempt was to try something like the following:

# create temp user
tmp_user=`head -c 10 /dev/random | base64 | head -c 10`

# create user
sudo useradd $tmp_user;

# run browser
sudo -u $tmp_user `which firefox`

# hold and wait then kill account
sudo userdel $tmp_user

I got so far as sudo -u $tmp_user firefox the following error displayed:

sh: 0: getcwd() failed: No such file or directory

sh: 0: getcwd() failed: No such file or directory

No protocol specified

Failed to connect to Mir: Failed to connect to server socket: No such file or directory Unable to init server: Could not connect: Connection refused Error: cannot open display: :0


I then tried firejail, however, I think I misunderstood what this prgoram was meant to do. The main firefox window and one started under firejail firefox was aware of each others login sessions.

  • 1
    A simple way would be to use Firefox's "Private browsing" mode, a private browsing window will be unaware of other Firefox windows, and won't share logins, cookies, and so on. Is something like this what you want to achieve ? – JonasCz - Reinstate Monica Jun 6 '16 at 16:51
  • Look into using different Firefox profiles and the firefox -no-remote command-line option. kb.mozillazine.org/… and developer.mozilla.org/en-US/Firefox/Multiple_profiles for more info. @JonasCz 's solution is also a good one. – Nick Weinberg Jun 6 '16 at 16:51
  • @JonasCz That works if I'm only worried about the admin role and a normal user. But that only gives me two distinct work spaces. I need about four distinct work-spaces where I can just throw away the session and start again. – Rick Jun 6 '16 at 16:52
  • 1
    There's an addon called Multifox which will allow you to have more than two independent sessions at the same time. – JonasCz - Reinstate Monica Jun 6 '16 at 16:57
  • 1
    Use gksudo instead of sudo for graphical applications. – Dorian Jun 6 '16 at 17:01

With Chromium, or Google Chrome, just tell it to use different data directories:

google-chrome --user-dir=/tmp/admin
google-chrome --user-dir=/tmp/unauth
google-chrome --user-dir=/tmp/normal

Then you can just delete these directories when you're done.

Or if you want random temporary directories:

google-chrome --user-dir=$(mktemp -d)
  • 1
    this works with firefox as well - firefox --no-remote --profile "profiledir" as long as "profiledir" exists, even if empty – user448115 Jun 6 '16 at 23:34

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.