If from the title it is not clear to you what this article is about, I will quickly explain that the profile is the directory where the browser stores all your user data: bookmarks, extensions, settings, customizations, passwords, etc. Creating a new profile means that you can open a new browser window that will behave as if it were a different browser, with bookmarks, extensions and customizations totally independent of your normal profile.
Google Chrome, as well as other browsers, allows you to create as many profiles as you want and use them all at the same time if you want, and the interesting thing about the topic is that nothing you do in any of them will affect the others at all; they will behave practically as if they were different programs.
In this post we will see how to create a temporary profile in a simple way. A temporary or disposable profile is a profile that is created the moment you call it and it self-destructs as soon as you close the window. Some of the cases in which a temporary profile may be useful to you are:
- When you want to try an experimental or unreliable extension and you don't want to put the security of your main profile at risk.
- When you have several accounts on the same site (for example, several emails from gmail) and you want to enter all of them at the same time (one for each profile).
- When you are testing a website and you want to know how it looks without the extensions and customizations of your normal profile interfering.
- When someone asks your PC to navigate and you don't want them to access the information stored in the browser.
Among many other uses that you will surely know how to find.
Previously, to create a temporary profile in Google Chrome o Chromium it was enough to use the flag –Temp-profile; that is, we only had to execute this command:
And that was enough. However, for some reason that flag was withdrawn, unless the developers of Chrome decide to bring it back I have created a little method to replace it.
The first thing we will do is open our favorite text editor and paste the following lines:
rm -r $HOME/.$PROFILE
As we can see, it is a script who uses the $ RANDOM function to create a random hidden directory in the user folder, then launch Google Chrome (if you use Chromium you will have to replace google-chrome by chromium o chromium-browser according to the name it receives in your distro) adding the flag –User-data-dir to tell it to use the previously created directory as a profile, and finally destroy the directory when we have closed all browser windows.
We keep the script with the name we want; for example, chrome temp, then we enter the directory where it was saved through the console and give it execution permissions:
$ chmod a+x chrome-temp
Now we move it to the / usr / bin directory so we can easily invoke it:
# mv chrome-temp /usr/bin
And voila, we can launch Google Chrome in a temporary profile by typing chrome-temp & on the console.
If we want to make things even easier, we can create a shortcut to launch it like any other program. For this we open the text editor again and paste these lines:
Name=Google Chrome Temp
Where the important parts are:
- Name = Name of the shortcut.
- Exec = Name that you have given to the script.
- Icon =google-chrome, chromium o chromium-browser.
We save that file on the desktop with a .desktop extension; for example, chrome-temp.desktop, and we already have a shortcut on the desktop to launch Google Chrome in a temporary profile.
Finally, we can copy it to the directory of shortcuts so that it also appears in the menus:
# cp chrome-temp.desktop /usr/share/applications
The result will look something like this (depending on the desktop environment you use, it may be necessary to log out and log back in for the shortcut to appear):
A characteristic of the script is that every time we click on the shortcut, a new temporary profile will be launched regardless of whether we already have another active at that time, and thanks to the function $ RANDOM, in theory we can create and use up to 32768 profiles at the same time; if it is our hardware holds so many thousands of windows open. 😀