How do I run Google Chrome as root? [closed]

2019-03-12 16:51发布

I have installed Google Chrome in Ubuntu 10.10. When I try to use in normal user, it is working fine.

Now if I want to use as a root it gives the following error:

Google Chrome does not run as root

Also when I tried the following command in terminal, it opens Google Chrome:

google-chrome --user-data-dir

I need a permanent solution for this. Can anybody give me idea about this?

9条回答
Luminary・发光体
2楼-- · 2019-03-12 17:20
I tried this with Kali linux, Debian, CentOs 7,And Ubuntu

(Permanent Method)

  1. Edit the file with any text editor (I used Leafpad) Run this code your terminal leafpad/opt/google/chrome/google-chrome

  2. (Normally its end line) find exec -a "$0" "$HERE/chrome" "$@" or exec -a "$0" "$HERE/chrome" "$PROFILE_DIRECTORY_FLAG" \ "$@"

  3. change as exec -a "$0" "$HERE/chrome" "$@" --no-sandbox --user-data-dir

(Just Simple Method)

Run This command in your terminal

$ google-chrome --no-sandbox --user-data-dir

Or

$ google-chrome-stable --no-sandbox --user-data-dir
查看更多
Juvenile、少年°
3楼-- · 2019-03-12 17:21

Chrome can run as root (remember to use gksu when doing so) so long as you provide it with a profile directory.

Rather than type in the profile directory every time you want to run it, create a new bash file (I'd name it something like start-chrome.sh)

#/bin/bash
google-chrome --user-data-dir="/root/chrome-profile/"

Rember to call that script with root privelages!

$ gksu /root/start-chrome.sh
查看更多
萌系小妹纸
4楼-- · 2019-03-12 17:25

Just replace following line

exec -a "$0" "$HERE/chrome" "$@"

with

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

all things will be right.

查看更多
登录 后发表回答