3

How do I run chrome as root in Ubuntu 12.04?

2
  • 7
    You do realize you open your system up for anyone on the outside trying to get into your machine using a possible exploit?
    – Rinzwind
    Apr 20, 2014 at 12:02
  • 1
    Rinzwind is right - it's a big security hole. There's whole sort of javascript malware that can hide on websites, and by running any browser as root you're just yelling "Heeeeey, over here, hack me! " Nov 22, 2015 at 23:28

6 Answers 6

5

Open google-chrome located in /usr/bin with 'gedit', 'kate' or your favorite text editor:

sudo gedit /usr/bin/google-chrome

Add --user-data-dir (without the quotes) at the very end of the file. Mine looks like this:

exec -a "$0" "$HERE/chrome" "$@" --user-data-dir

Save, close and voilà, you're done. You can open chrome as root now.

3
  • Question was How do I run chrome as a root user in Ubunut 12.04?? Hence my answer
    – Back.Slash
    Apr 20, 2014 at 12:08
  • Title states chromium so I took that one (and cuz chromium is in the repos and chrome aint ;) ). Lets see who wins by upvotes :D (here have one from me ;) ) edit: I removed the html tags :)
    – Rinzwind
    Apr 20, 2014 at 12:11
  • So we can consider this a tie after 1.5 years :-D
    – Rinzwind
    Oct 23, 2015 at 9:50
3

DISCLAIMER/Warning: Running anything as root is risky and you should not run any software as root when you don't have to. If you don't know what you're doing, or are on a system that needs to be secure, STOP READING NOW

This is about this message:

enter image description here

And you need to hex edit chromium:

sudo apt-get install hexedit
cd /usr/lib/chromium-browser
sudo cp chromium-browser chromium-browser.backup
hexedit chromium-browser

Do control+s and search for geteuid; change it to getppid and control-x to exit.

And you can start chromium as root.

To revert the change:

cd /usr/lib/chromium-browser
sudo cp chromium-browser.backup chromium-browser
3
1

Edit file /etc/chromium-browser/default.

Add line CHROMIUM_FLAGS=" --user-data-dir".

You are done. Launch Chromium.

1
  • 2
    Note that since a Chromium update, this solution no longer works. It worked in the past.
    – Lucio
    Apr 23, 2017 at 2:58
1

Try using

chromium --no-sandbox
0

This worked for me in Ubuntu on both Nexus 7 (Ubuntu 13.04) and x86 PC (Ubuntu 15.10) running as root:

chromium-browser --temp-profile 

Help gives this:

--temp-profile          Start with a new and temporary profile

(Nexus 7 had other but presumably unrelated issues)

This answer was supposed to be a comment as this may not be true for 12.04, but I can't comment as a forum newbie.

Usual warning: Running as root is dangerous.

-1

Simple rly. Fastest way. But this isn't recomended.

chromium-browser --user-data-dir=/home/someuser

3
  • Explain why it isn't recommended. Oct 23, 2015 at 8:53
  • Security reasons. :)
    – PawelC
    Oct 23, 2015 at 9:08
  • Why downvote? I use --user-data-dir=/root/.data If I want to use root user, and I don't see any reasonable security concerns. May 19, 2016 at 20:01

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .