[:en]Running Firefox as a different user: A convenience hack for social networks and instant messaging[:]

[:en]Social convention requests that I be active on Facebook. Recently, I have also been persuaded to get myself a WhatsApp account. I have two issues with that:

  • I strongly prefer to keep social networks in a „privacy container“. It is no business of Facebook, where I surf on the web. Thus, I’d like to keep social networking sessions separate from my day-to-day surfing (this also applies to my Google account, of course).
  • When chatting, it is an absolute necessity for me to be able to use my keyboard. Smartphones are, in my opinion, not a good device to use for chatting. Typing on a touchscreen slows me down in an unbearable manner—not mentioning the fact that half of my data is not available on my smartphone.

As long as I used Facebook, I was content to open up a Firefox „private window“ whenever someone messaged me, continuing the conversation from there. This required a single login, but I regularly could type that faster than the page loaded. However, with WhatsApp this is different. The web interface requires me to scan a QR code every time I want to log in. I will not comment on the architectural reasons behind that (it’s just too ridiculous). However, another approach is needed.

My plan, therefore: Having a dedicated Firefox session for social networks and chatting.

Unfortunately, Firefox does not support running two separate processes as the same user. It does support having different user profiles—but those cannot run in parallel. I would have had to shut down my regular session to open the social network session. Not an option!

So I came up with the idea of creating a dedicated user for running this Firefox session. Turns out this is not quite as straightforward as expected, but with a bit of hacking it works surprisingly well.

Step 1: I need a new user. I’ll call this one „snim“ for „Social Networks and Instant Messaging“. Under Ubuntu:
sudo adduser –disabled-password snim
I disabled the password, because I do not want to ever log into that account. It’s just there for running my Firefox process.

At this point I expected step 2 would be as easy as allowing a sudo for Firefox. Turns out it is not: Firefox needs access to the current X11 session and requires a full user environment to play nicely with temporary files and the likes. So sudo -u snim firefox actually does not work. Well, the solution is to create a small shell script, instead:

xhost + # Allow X11 access
su -c firefox - snim # Execute firefox in the environment of "snim"

There’s still the problem that this script would ask me for the password of „snim“—which I deliberately deactivated before. So, instead I’ll have to add a line to the /etc/sudoers file that allows me to execute that script without asking for a password. The line is simple:

# ... (stuff before)

# ... at the end: the firefox-hack
myusername   ALL=(ALL) NOPASSWD: /path/to/my/firefox_hack

Of course, „myusername“ has to be replaced with the actual user name and „/path/to/my/firefox_hack“ should be the path to the script above.

Having that, a sudo /path/to/my/firefox_hack will start a separate Firefox session without asking for a password. In that session I can now keep Facebook, WhatsApp and Google logged into my accounts at all time, without having any other data from my regular browsing session „spill over“. I keep the three websites open in tabs, set Firefox to remember my tabs, and define a shortcut for the sudo command above. Bam! Convenient privacy-aware social networking and chatting :)


Dieser Eintrag wurde veröffentlicht in Sys, Uncategorized. Fügen Sie den permalink zu Ihren Favoriten hinzu.

Kommentare sind geschlossen.