如何讓讓chrome變成相互獨立independent chrome

By default, 各個chrome window背後的cookies等資料是同一份,屬於同一個instance (or say session)
當chrome上希望同時用兩個帳號登入的話,就會希望chrome可以有"獨立"運作的機關。解法就是:如何讓chrome windows跑在不同的instance?

Chromium browser

This page describes how to run latest Chromium browser (v30) faster, keep it secure and your privacy protected.

Terminology
Instance
Browser, that shares all data (cookies, sign in, etc) among all processes running with this instance. Instance is associated with profile.
Profile
Folder, that allows to run a new (and separate) instance of the browser. See details here.
User
Users are defined within one instance. User accounts contain separate preferences and states. User data is located within Profile folder (e.g. DefaultProfile 1Profile 2, etc). See details here.
Keep in mind
  • When you launch new Chromium browser, first it checks, if any other instance of the browser is already running using the same profile. If there is one, the new window will be associated with the old instance (unless you specifically ask it to run with a different profile). It's important to remember, there is always a link between profile and instance of the browser. You can run only one instance with one profile.
  • All windows running by one instance of Chromium browser share all its data (cookies, sign in credentials, history, etc). It happens when you run Chromium browser with its default configuration. To make sure, that web sites you visit now can not get information from other sites you're connected to now or visited earlier, you have to run a separate instance of the browser. And again, separate instances of Chromium browser require using different profiles.
  • You can run many instances (separate sessions) of Chromium browser at the same time by specifying different profiles for each of them. To launch Chromium browser with specific profile use this command line option:
    -user-data-dir=PathTo\profile
    
  • To protect privacy Chromium offers Incognito mode (browse in private). But all incognito windows, that you open, share the same profile. It means that incognito windows do not offer any protection from cross site tracking attacks or other similar vulnerabilities. You can't even sign in using two different accounts to the same site at the same time (because incognito windows share cookies). If you want complete separation of browser sessions, do not use incognito windows. Launch different browser instances instead.
  • By default Chromium browser makes unsolicited connections to farm of Google computers. To prevent browser from making those connections launch it with this command line option:
    --disable-background-networking
    
Profile

Profile folder contains: a) configuration settings and b) temporary data (various caches, temporary files, databases of tracking data, history, session storage, etc). The former is important to keep (if you want to have your settings permanent), while the latter could be easily discarded. Moreover, if you're concern about tracking data always accumulated in your computer and don't want to keep that data indefinitely, it's recommended to remove it on a regular basis.

Here is list of configuration files, that you may want to keep in your Profile folder:

Profile:
│
└───Default
    │   Bookmarks
    │   Cookies
    │   Custom Dictionary.txt          -- personal dictionary
    │   Favicons
    │   Preferences
    │   Web Data                       -- to keep Search engine configured
    │
    └───databases
            Databases.db               -- required by some extensions

Other files/folders, residing within Profile folder, are temporary and could be removed at any time (with browser closed, of course).

Copying custom profile

We recommend to make a copy of your custom profile. In order to do so:

  1. Run Chromium browser, adjust all its settings per your needs, install your browser exertions, etc. When you done, close the browser.
  2. Copy configuration files from your current profile, used in p.1 into some folder (e.g. D:\Tmp\Chrm\p). See the list of configuration files recommended to copy into that new folder above. To make the task easier we recommend to useChrmCopyProf.bat file (see description below)
  3. At this time you may want to create a backup copy of that new custom profile folder as well. Copy your new custom profile folder into a new e.g. D:\Tmp\Chrm\p.def folder. When you run browser with custom profile folder directly, its content is quickly polluted with temporary files. Thus, by keeping backup copy separately, you may easily remove your custom profile and copy it back from that backup copy at any time later.

Now you may run your browser, pointing to that new custom profile folder (D:\Tmp\Chrm\p) as your new profile.

ChrmCopyProf.bat

This script facilitates task of making copy of all configuration files from current profile into a new folder.

How to use it:

  • Run it from CMD window (or directly by clicking on it within Windows Explorer). Scrip will ask you to specify source folder (where your current profile is, usually it's in some default location, see Chromium help to find out where this folder is in your computer) and it will ask for new folder name, where you want to put copy of configuration files (in our example let say it's D:\Tmp\Chrm\p). If destination folder is already exist, script will ask your permission to overwrite its content with new data.
  • Using Windows Explorer you may drag your current profile folder into the ChrmCopyProf.bat icon. It will start script and use it as source profile (folder you want to make copy from).
  • When you'll be asked for a destination folder name you may simply press Enter. In this case destination folder will have the same name plus suffix .def, appended to it.
  • If you want a silent run of the script - specify /p as its first option in command line, running the script. It will do its job silently, unless there is a problem... You may find it useful, when you run the script form a shortcut, where you specify both source and destination folders and you want it just ot make that copy quick.
Running separate instances

Generally there are two ways of running Chromium browser with custom profiles that we may recommend:

  • Running browser with permanent custom profile.
    This will accumulate new data (browsing history, cookies, other data) in that folder. All browser windows running with this custom profile will share data as usual. If you have created (as it was recommended earlier) and keep backup copy of that profile folder (e.g. in D:\Tmp\Crhm\p.def) you can replace your current custom profile folder with that backup copy at any time later manually.
  • Running browser with temporary custom profile.
    All browsers launched this way will have separate and unique instances and will not share any data. All history, cookies, other browsing related data is removed automatically, when you close that instance of the browser.
Running with permanent custom profile

It will run Chromium browser using specific custom profile. You may adjust all browser settings, accept cookies, install new extensions, etc and save it in the same profile folder. And you can make a new copy from that profile at any time and use it as your new default profile.

  1. Copy your custom profile into a folder, e.g. to D:\Tmp\Chrm\p
  2. Create a shortcut, with Target containing a command line similar to this one:
    "%ProgramFiles%\Chromium\chrome-win32\chrome.exe" -user-data-dir="D:\Tmp\Chrm\p"
    
  3. Use that shortcut to launch a new window of Chromium browser

Note: all subsequent runs will reuse the same profile and, therefore, potentially collect and share all its data.

Running with temporary custom profile

You can launch s new Chromium browser instance completely separated from other instances, by clicking on a shortcut (see instructions below). Every time you click on it, the new and unique instance of the Chromium browser will be created. The new instance of the browser will not share any data with other running instanced. And when you close the browser all browsing history, cookies, other session data will be deleted automatically.

In order to do so you need:

  1. Make a new and unique temporary profile folder. Copy into it your custom profile from backup copy made earlier (D:\Tmp\chrm\p.def folder).
  2. Launch new instance of Chromium browser, using that new folder as its profile
  3. After you close the browser, remove that temporary folder.

We offer you ChrmNewInst.bat script, that will do all of the above automatically. If you don't want to see ugly black CMD window, running the BAT file when you use browser, you may want to run it in a hidden window. It's easy to do with our CMDHtool.

You may want to make a new shortcut, that will launch new instance of Chromium with unique temporary profile. It's Target could contain command line, similar to this one:

"C:\WINDOWS\CMD\cmdh.exe" "C:\WINDOWS\CMD\ChrmNewInst.bat"

Note: command line points to CMDH.exe tool (put it in any appropriate directory) and to ChrmNewInst.bat file, that will actually do the job.

All running sessions, started with this shortcut, are completely independent and unique. They won't share any data and the data itself will not be preserved for next runs.

ChrmNewInst.bat

Script accepts any options, that could be used with Chromium browser. You can launch browser in multi process mode (see example above). Or you may want to launch it in a single process mode, opening a web site at its start. For example, you may run it from a shortcut with this Target:

"C:\WINDOWS\CMD\cmdh.exe" "C:\WINDOWS\CMD\ChrmNewInst.bat" www.google.com --single-process
How to use it

If you use your temporary custom profile, you may want to:

  • Keep two copies of your custom profile, let seay in these folders:
    D:\Tmp\Chrm\p                          -- custom profile with current history, data, etc
    D:\Tmp\Chrm\p.def                      -- default custom profile
    
  • To launch new browser window with temporary custom profile use this shortcut:
    "C:\WINDOWS\CMD\cmdh.exe" "C:\WINDOWS\CMD\ChrmNewInst.bat"
    

    Make sure that ChrmNewInst.bat script inside has there settings:

    set Program="%ProgramFiles%\Chromium\chrome-win32\chrome.exe"
    set ProfDef="D:\Tmp\Chrm\p.def"
    set ProfTmp=%TEMP%
    

    If you have a different environment, adjust them accordingly.

  • When you need to change settings in your default custom profile:
    1. Launch browser using permanent custom profile method. Use this shortcut:
      "%ProgramFiles%\Chromium\chrome-win32\chrome.exe" -user-data-dir="D:\Tmp\Chrm\p"
      
    2. Change your settings, add extensions, new cookies, etc. Then close the browser.
    3. Copy your new default profile into p.def folder using this shortcut:
      "C:\WINDOWS\CMD\cmdh.exe" "C:\WINDOWS\CMD\ChrmCopyProf.bat" /q D:\Tmp\Chrm\p D:\Tmp\Chrm\p.def
      

    After that all your new instances of browser you launch are going to use that new profile.

  • If you want to get rid of the data accumulated in your custom profile folder (D:\Tmp\Chrm\p), replace its content with data from D:\Tmp\Chrm\p.def folder. Just remove whole the folder, make new one and copy all content from default folder directly into it.

Note:
   D:\Tmp\Chrm\p - profile folder contains (and continue to accumulate) all temporary data
   D:\Tmp\Chrm\p.def - profile folder contains only configuration files, that you want to keep

Recommendations
  • For every day use we recommend using Chromium browser with temporary custom profile. It's the most secure way to run, which protects your privacy. You'll be guaranteed, that there will be no cross-site vulnerabilities, no third party hidden web tracking, that could happen silently and without your consent. You'll not have problems with making several different sign ins into the same web site at the same time (just run a new instance of the browser and sing in with new account). Your browsing history, session storage, cookies, that you don't want to keep in your browser, will be removed immediately upon exiting your browser.
  • If you need to change Chromium browser settings, add permanent cookies, etc, run CHromium with permanent custom profile, make all needed changes, visit sites that you want to keep new cookies from, accept those cookies. Then exit browser and extract (with help of ChrmCopyProf.bat script) your new custom profile again and start using it as your new default profile.
  • If you put your Chromium package and copy of your custom profile into a USB drive, you may run browser as a portable application on any computer. Just adjust ChrmNewInst.bat file to point browser to your new default profile and run it from there. There is no need for any special package, making Chromium package portable.
  • If you want to run your browser faster (and more secure at the same time), use a RAM drive programs, that create virtual disk in the RAM on the fly. You can change ChrmNewInst.bat script (and particularly its ProfTmp parameter) to point to that RAM disk. All new and unique session profiles will be created there, making browser run faster. And when you close your browser everything from that profile will be erased. You can find an example of a free RAM disk program here - RAMDisk.
Download

The latest Chromium build you can download from Softpedia. Unpack zip file into any folder, e.g. %ProgramFiles%\Chromium.

Download: ChrmProf_1.2.zip (zip contains ChrmCopyProf.bat and ChrmNewInst.bat files).

Size: 2064 bytes (3.0 KiB)

CRC32: 539E89B4; MD5: 0D40979F22E4295412B368FED10C8494


Home


Last modified: 2017-01-01

[source: http://www.gate2.net/TnT/ChrmSecure.html