Posts
Search
Contact
Cookies
About
RSS

staying logged into gmail, without browsing logged into your google account

Added 15 Jan 2013, 7:40 a.m. edited 18 Jun 2023, 1:12 a.m.

"Do no evil" - sadly it can be argued that Google's mantra of do no evil is being gradually eroded.  Of particular concern to me is the change of behaviour with Google accounts.  You used to be able to stay logged into gmail with one window and search in another window without being logged into your Google account, it was your choice.  Nowadays however as soon as you log into your Google account (seemingly regardless of product you're using) you seem to be globally logged into all of the Google product you use.

Fortunately Chromium and Google Chrome allow the user data directory to be changed upon execution with a command line switch, assuming you use Linux, the default data directory is in your home folders .config directory.  We can make a new directory which we'll use solely for logging into and using gmail.

mkdir ~/.config/chromium-gmail

Turns out you don't really need to create the folder for chrome...

Test this out by running

chromium-browser --user-data-dir=~/.config/chromium-gmail gmail.com

oopsie ! this isn't 100% correct (see if you can guess what I did wrong - although it still works! answer at the bottom of the post!)

Log into gmail, remembering to select remember me and also if you're using two step authorisation (and you really should be!) click the box to remember the authorisation.  Close down the browser and run the command again just to verify it sends you straight to your inbox.

You can now start a normal browser session as you would normally and you'll notice you're not signed into your Google account.

For convenience I have a "binary" directory in my home directory (/home/chris/bin) which in reality is a dumping ground for a whole bunch of short little script fragments that I like... if you make a one line script (remembering to make it executable) you have a convenient little script you can use to execute with a desktop shortcut.

While reinstalling different distro's to try them out will quite often wipe directories like Desktop but will leave your own directories alone... keeping short-cuts separate from scripted on liners you could have in the Exec= line of a .desktop file will at least isolate them from re-installations...

NB don't use tilde expansion for the data directory you need to use the full path.  If your user name is "chris" for example....

chromium-browser --user-data-dir=/home/chris/.config/chromium-gmail gmail.com