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?
Run from terminal
# google-chrome --no-sandbox --user-data-dir
or
Open the file opt/google/chrome/google-chrome and replace
exec -a "$0" "$HERE/chrome" "$@"
to
exec -a "$0" "$HERE/chrome" "$@" --user-data-dir --no-sandbox
It's working for chrome version 49 in CentOS 6. Chrome will give warning also.
First solution:
1. switch off Xorg access control: xhost +
2. Now start google chrome as normal user "anonymous" :sudo -i -u anonymous /opt/google/chrome/chrome
3. When done browsing, re-enable Xorg access control:xhost -
More info : Howto run google-chrome as root
Second solution:
1. Edit the file /opt/google/chrome/google-chrome
2. find exec -a "$0" "$HERE/chrome" "$@"
or exec -a "$0" "$HERE/chrome" "$PROFILE_DIRECTORY_FLAG" \ "$@"
3. change asexec -a "$0" "$HERE/chrome" "$@" --user-data-dir ”/root/.config/google-chrome”
Third solution:
Run Google Chrome Browser as Root on Ubuntu Linux systems
Go to
/opt/google/chrome
.Open
google-chrome
.Append current home for data directory. Replace this:
exec -a "$0" "$HERE/chrome" "$@"
With this:
exec -a "$0" "$HERE/chrome" "$@" --user-data-dir $HOME
For reference visit site this site, “How to run chrome as root user in Ubuntu.”
i followed these steps
Step 1. Open /etc/chromium/default file with editor
Step 2. Replace or add this line
CHROMIUM_FLAGS="--password-store=detect --user-data-dir=/root/chrome-profile/"
Step 3. Save it..
Thats it.... Start the browser...
Just replace following line
exec -a "$0" "$HERE/chrome" "$@"
with
exec -a "$0" "$HERE/chrome" "$@" --user-data-dir
all things will be right.
STEP 1: cd /opt/google/chrome
STEP 2: edit google-chrome file. gedit google-chrome
STEP 3: find this line: exec -a "$0" "$HERE/chrome" "$@"
.
Mostly this line is in the end of google-chrome file.
Comment it out like this : #exec -a "$0" "$HERE/chrome" "$@"
STEP 4:add a new line at the same place.
exec -a "$0" "$HERE/chrome" "$@" --user-data-dir
STEP 5: save google-chrome file and quit. And then you can use chrome as root user. Enjoy it!
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
It no longer suffices to start Chrome with --user-data-dir=/root/.config/google-chrome
. It simply prints Aborted
and ends (Chrome 48 on Ubuntu 12.04).
You need actually to run it as a non-root user. This you can do with
gksu -wu chrome-user google-chrome
where chrome-user
is some user you've decided should be the one to run Chrome. Your Chrome user profile will be found at ~chrome-user/.config/google-chrome
.
BTW, the old hack of changing all occurrences of geteuid
to getppid
in the chrome
binary no longer works.
I tried this with Kali linux, Debian, CentOs 7,And Ubuntu
(Permanent Method)
Edit the file with any text editor (I used Leafpad) Run this code your terminal
leafpad/opt/google/chrome/google-chrome
(Normally its end line) find
exec -a "$0" "$HERE/chrome" "$@"
orexec -a "$0" "$HERE/chrome" "$PROFILE_DIRECTORY_FLAG" \ "$@"
- 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
来源:https://stackoverflow.com/questions/12258086/how-do-i-run-google-chrome-as-root