Skip navigation.

Log in | Sign up

Opera Private mode

, ,

While Opera doesn't have a built in private mode (yet?), it is fairly easy to make it behave in a very private way. You have probably noticed the -private command line option listed in opera -help and tried it to see what it does. We had an implementation of private mode internally some time ago which we unfortunately didn't finish, and we forgot to remove this option when we decided not to release it.

But fear not, it is still possible to make Opera behave privately! All you have to do is use a simple wrapper script that sets up a protected and random personal directory (the place opera stores all its user data). I know, "script". It may sound daunting, but it really isn't, as long as you know how to save a file as root, aka "super user".

Running Opera in Private mode is very nice if your PC is borrowed by people you know - simply make them use the Opera Private mode browser, and they don't have to worry about you seeing anything they didn't want you to see.

What it does is quite simple:

  1. Define a temporary random name folder to store the data in.
  2. Set the umask to 0077, which means that all the files will be unreadable to anyone but the one who started Opera
  3. Insert settings in the opera6.ini file, to prevent you from having to see the licence dialog and the KDE keyboard shortcuts message every time, in addition to setting the Opera title to "Opera Private mode"
  4. When you exit, the folder will be removed.

Thanks to Arve for the initial implementation.

To set it up, fetch the opera private mode wrapper and follow the instructions.

I haven't investigated how this can be done on Windows and Mac, but it should be possible there too. (Please tell me!)

Opera Link explained

Comments

FataL 16. December 2008, 18:14

Nice start, hope to see human interface for this in beta version. :smile:

edvakf 17. December 2008, 20:46

for Mac OS X
===========================
#!/bin/bash
umask 0077
export dir="$HOME/Library/Preferences/Opera Preferences private"
mkdir -p "$dir"
echo -e "[User prefs]\nTitle=Opera Private mode" > "$dir/Opera 9 Preferences"
/Applications/Opera.app/Contents/MacOS/Opera -personaldir private 2> /dev/null
rm -r "$dir"
rm -r "$HOME/Library/Caches/Opera private/"
rm -r "$HOME/Library/Application Support/Opera private/"
===========================

Save the above as opera-private.sh and do
===========================
chmod 700
===========================

Put it into a folder with a setting file and icons, rename the folder to .app
Then there you go. Really simple OperaPrivateMode.app for Mac OS X.
I created a package below.
http://edvakf.googlepages.com/OperaPrivateMode.app.zip

godjonez 17. December 2008, 22:45

For Windows XP (likely works on newer versions too, can't say for too sure about earlier versions):

@echo off
set operadir=%TEMP%\%RANDOM%
mkdir %operadir%

echo [User prefs] > %operadir%\opera6.ini
echo Title=Opera Private mode >> %operadir%\opera6.ini
echo Opera Directory=%operadir% >> %operadir%\opera6.ini
echo Opera Local Directory=%operadir% >> %operadir%\opera6.ini
echo [State] >> %operadir%\opera6.ini
echo Accept Licence=1 >> %operadir%\opera6.ini

start "Opera Private mode" /wait "C:\Program Files\Opera\opera.exe" /Settings %operadir%\opera6.ini

rmdir /s /q %operadir%


Make sure to edit the start line with correct Opera path if you have it installed in another path.

Save the file with .cmd or .bat extension (both work) and put it to an accessible location.


Edited 18th Dec: The folder structure was retained in temp folder, changed to use rmdir to clear it.

thetomster 20. December 2008, 14:46

@godjonez: on my xp sp2 build 2007 it works, thank you

godjonez 20. December 2008, 18:19

Thanks for the feedback, thetomster.

basseman 11. June 2009, 23:39

that works fine with Opera 9.X
however with Opera 10 Beta, it doesn't work

I modified the script to make it easy to switch between 9.X install and 10 Beta.
as you can see I made the filename operaprefs.ini and modified the install path. But still when I load my opera 10 it still use the default operaprefs

@echo off
set operadir=%TEMP%\%RANDOM%
rem set operadir=c:\temp\test
rem set filename=opera6
set filename=operaprefs
mkdir %operadir%

echo [User prefs] > %operadir%\%filename%.ini
echo Title=Opera Private mode >> %operadir%\%filename%.ini
echo Opera Directory=%operadir%\ >> %operadir%\%filename%.ini
echo Opera Local Directory=%operadir%\ >> %operadir%\%filename%.ini
echo Operator Cache Directory4=%operadir%\opcache\ >> %operadir%\%filename%.ini
echo [State] >> %operadir%\%filename%.ini
echo Accept Licence=1 >> %operadir%\%filename%.ini

rem start "Opera Private mode" /wait "C:\Program Files\Opera\opera.exe" /Settings %operadir%\%filename%.ini
start "Opera Private mode" /wait "C:\Program Files\Opera 10 Beta\opera.exe" /Settings %operadir%\%filename%.ini

rmdir /s /q %operadir%

godjonez 12. June 2009, 15:17

The filename does not hold any significance because you give it the file name, not the path. There is a bug in Opera 10 beta that the /Settings parameter simply does nothing.

fearphage 3. July 2009, 09:35

Originally posted by godjonez:

There is a bug in Opera 10 beta that the /Settings parameter simply does nothing.

Resolved in the latest build.

I have added to godjonez's script to accommodate automatically for 32 and 64 bit windows:
@echo off
set operadir=%TEMP%\delete-me.%RANDOM%
call :CLEANUP %operadir%&GOTO :FIN

:CLEANUP
for /d %%a in (%~dspn1.*) do (rmdir /s /q "%%a" 2> NUL)

:ACTION
mkdir %operadir%
set operaini=%operadir%\operaprefs.ini

echo [User prefs] > %operaini%
echo Title=Opera Private mode >> %operaini%
echo Opera Directory=%operadir% >> %operaini%
echo Opera Local Directory=%operadir% >> %operaini%
echo Show Default Browser Dialog=0 >> %operaini%
echo Enable Usage Statistics=0 >> %operaini%
REM Comment out the next line if you want 3rd party links to open in the private version of opera
echo Enable DDE=0 >> %operaini%

echo [State] >> %operaini%
echo Accept Licence=1 >> %operaini%
echo Run=0 >> %operaini%

set operaexe=%PROGRAMFILES%\Opera\opera.exe
REM 64-bit check
if not "%PROGRAMFILES(X86)%X" == "X" set operaexe=%PROGRAMFILES(X86)%\Opera\opera.exe
call :RUNTIME "%operaexe%" %operaini%&goto :EOF

:RUNTIME
start /max /D %~dsp1 /B %~dspnx1 /Settings %~dspnx2 opera:blank

:FIN
set operadir=
set operaini=
set operaexe=


I also set a few additional options and things which you can freely remove. A big difference with mine is it does not wait for opera to close. It cleans up before it is run instead of after.

godjonez 4. July 2009, 19:09

Thanks for the revised script, fearphage.

The way yours checks for 32/64 bit would be fine for some setups, but since Opera can be installed on other folder than the default one (and Opera 10 installs in different folder anyway), it's still not a perfect solution. That's the reason I left the exe path very simple on my script, so that the user can edit it to point to the correct folder.

Of course, if there was a way to get the Opera's location from registry, it would be much better. Too bad there is not a built-in way to do that with Windows command scripts, but it is possible if used together with my regshx program. (see my blog for more info about that)

DanielHendrycks 5. September 2009, 00:13

Nice to see an employee pays attention to this feature. Maybe 10.1 :up:

Write a comment

You must be logged in to write a comment. If you're not a registered member, please sign up.

December 2009
S M T W T F S
November 2009January 2010
1 2 3 4 5
6 7 8 9 10 11 12
13 14 15 16 17 18 19
20 21 22 23 24 25 26
27 28 29 30 31