HACKER Q&A
📣 appleflaxen

How do you set up a virtual browser


When you need to do something on your computer that might be risky (like run a suspect executable) you can use a VM and feel comfortable safe in your ability to isolate it.

But how do you isolate your browser? There are so many cookies and identity bits in it that I want a bare-bones profile. It would be similar to the chrome-new command that someone posted previously, but it would let me pack in the non-identity parts of my experience:

- don't offer to save any passwords

- prompt for location on every download

- use the following ten search shortcuts

and maybe install an ad blocker (contains identiny information, but not much).

Is this possible short of using something like chrome-driver? Like can I create a temp profile, then a bash script to copy it to a new location every time I run the browser and use the blank copy?

Thanks in advance for any insight you might have.


  👤 hotdox Accepted Answer ✓
I use next script. It creates temporarily dir for firefox, uses it as a profile dir and remove after firefox closed.

   #!/bin/sh -e
   DIR="${XDG_CACHE_HOME:-$HOME/.cache}"
   mkdir -p -- "$DIR"
   TEMP="$(mktemp -d -- "$DIR/firefox-XXXXXX")"
   trap "rm -rf -- '$TEMP'" INT TERM EXIT
   wget 'https://raw.githubusercontent.com/pyllyukko/user.js/master/user.js' -O "$TEMP/user.js"
   firefox -profile "$TEMP" -no-remote "$@"
It also uses very hardened options from https://github.com/pyllyukko/user.js

It is not my invention, but I lost a link to blog post


👤 yamrzou
If security is your concern, you can run the browser inside a container: https://github.com/ConSol/docker-headless-vnc-container

You can also use: https://browsergap.dosyago.com/

There is also: https://firejail.wordpress.com/


👤 nickphx

👤 gen3
Firefox has a bunch of setting like deleting cookies and history on close that can be configured. I find that hard to use as a daily driver. For me, Firefox containers and uBlock origin works well enough.

If you do want to do some auto config thing, I think it’s possible. Owasp ZAP has a button that auto configs a session with a whole bunch of features changed. It might be worth looking into how they do that. There is command line flags.


👤 gitgud
Is there a problem with "Incognito Mode"?

Modern browsers (Chromium and Firefox) are pretty well isolated as far as sand-boxing goes (compared to 15 years ago anyway).

But if you really want to avoid advanced finger-printing and tracking, then you really need to use a VPN or TOR. As sites can track your IP, OS, Browser, screen dimensions... etc