Results 1 to 10 of 10

Thread: Howto run google-chrome as root

  1. #1
    Join Date
    Feb 2008
    Location
    readlink("/proc/self/exe"
    Beans
    1,120
    Distro
    Ubuntu Development Release

    Wink Howto run google-chrome as root

    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, leave now.


    If you have installed google-chrome, you might recently have gotten the message:
    google-chrome cannot be run as root.

    Very annoying.

    Now here's the antidote:

    First, switch off Xorg access control:
    Code:
    xhost +
    Now start google chrome as normal user "anonymous"
    Code:
    sudo -i -u anonymous /opt/google/chrome/chrome
    When done browsing, re-enable Xorg access control:
    Code:
    xhost -
    In a world without walls and fences, who needs Windows and Gates?
    Linux is like a wigwam.... no Gates, no Windows but Apache inside!
    http://www.debianadmin.com
    apt-get install libstdc++6-4.3-doc

  2. #2
    Join Date
    Feb 2009
    Beans
    1

    Lightbulb Re: Howto run google-chrome as root

    Just want to add a permanent solution to the problem:

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

    Code:
    gedit /usr/bin google-chrome
    2. 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

    3. Save, close and voilą, you're done. Enjoy your favorite browser.

  3. #3
    Join Date
    Jun 2011
    Location
    The Shadow Gallery
    Beans
    6,803

    Re: Howto run google-chrome as root

    Quote Originally Posted by id2578 View Post
    Just want to add a permanent solution to the problem:

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

    Code:
    gedit /usr/bin google-chrome
    2. 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

    3. Save, close and voilą, you're done. Enjoy your favorite browser.
    You should never run a web browser as root, certainly not permanently.

    If there is a need to run it as root then do it for the given instance not a permanent fixture.

    It is ill advised to browse the internet as root.

    Cheers
    Feel Free to Bitcoin Tip: 135Rp4pwwYTHEJ4u8bxKaDQiC91N9LUoV2

    Backtrack - Giving machine guns to monkeys since 2006
    Kali-Linux - Adding a grenade launcher to the machine guns since 2013

  4. #4
    Join Date
    Jan 2012
    Beans
    5

    Re: Howto run google-chrome as root

    What would be the preferred (safe) way to operate in an environment where root is the only user?

  5. #5
    Join Date
    Feb 2008
    Location
    readlink("/proc/self/exe"
    Beans
    1,120
    Distro
    Ubuntu Development Release

    Wink Re: Howto run google-chrome as root

    Quote Originally Posted by Browncoyote View Post
    What would be the preferred (safe) way to operate in an environment where root is the only user?
    Quite simple:
    Open the google-chrome binary, located at
    Code:
    /opt/google/chrome/chrome
    in a hex editor (make a backup-copy before).

    Now find the string "geteuid" and replace it with "getppid".
    Done !

    Make a script for this, and trigger script execution every time google-chrome is updated
    In a world without walls and fences, who needs Windows and Gates?
    Linux is like a wigwam.... no Gates, no Windows but Apache inside!
    http://www.debianadmin.com
    apt-get install libstdc++6-4.3-doc

  6. #6
    Join Date
    Jun 2011
    Location
    The Shadow Gallery
    Beans
    6,803

    Re: Howto run google-chrome as root

    Quote Originally Posted by WitchCraft View Post
    Quite simple:
    Open the google-chrome binary, located at
    Code:
    /opt/google/chrome/chrome
    in a hex editor (make a backup-copy before).

    Now find the string "geteuid" and replace it with "getppid".
    Done !

    Make a script for this, and trigger script execution every time google-chrome is updated
    Well as said before it shouldnt be run as root.

    However if you need to there is no need to hex edit which wont work for all versions, no need to script or edit config files, you only need to append a command to the launcher.

    If you use icons to launch then append the following the to the command in the launcher

    Code:
    --user-data-dir
    or add it to the command from terminal such as

    Code:
    google-chrome --user-data-dir
    example the properties of the launcher command is as follows

    Code:
    /opt/google/chrome/google-chrome %U
    just change it to be

    Code:
    /opt/google/chrome/google-chrome –user-data-dir %U
    and thats it.

    Cheers
    Feel Free to Bitcoin Tip: 135Rp4pwwYTHEJ4u8bxKaDQiC91N9LUoV2

    Backtrack - Giving machine guns to monkeys since 2006
    Kali-Linux - Adding a grenade launcher to the machine guns since 2013

  7. #7
    Join Date
    Feb 2008
    Location
    readlink("/proc/self/exe"
    Beans
    1,120
    Distro
    Ubuntu Development Release

    Wink Re: Howto run google-chrome as root

    Quote Originally Posted by haqking View Post
    Well as said before it shouldnt be run as root.

    However if you need to there is no need to hex edit which wont work for all versions, no need to script or edit config files, you only need to append a command to the launcher.

    If you use icons to launch then append the following the to the command in the launcher

    Code:
    --user-data-dir
    or add it to the command from terminal such as

    Code:
    google-chrome --user-data-dir
    example the properties of the launcher command is as follows

    Code:
    /opt/google/chrome/google-chrome %U
    just change it to be

    Code:
    /opt/google/chrome/google-chrome –user-data-dir %U
    and thats it.

    Cheers
    I know that it shouldn't be run as root.

    But the bottom line is, a normal user just has so few rights, I don't want to bother with that ad infinitum (I'm a programmer, not a sysadmin).

    BTW: I have modified the launcher icon a long time ago.

    But the problem is, your/this variant doesn't work when you click on a link (e.g. in Thunderbird/E-Mail-Program-Of-Choice) when google-chrome is the default browser, etc. Same problem from instant messengers (pidgin), HTML editors, MonoDevelop (when I want to debug/test a web application on Linux), and wxWidgets C-programs that open helpfiles, as well as the Oracle installer (opens html file) etc.

    Furthermore, when run as other user (xhost + variant), there is no sound, and you cannot access the download directory in /root/ (no rights).

    So modifying the startup script like
    Code:
    exec -a "$0" "$HERE/chrome" "$@" --user-data-dir
    or patching the executable is really the only option (just added that info for information purposes, don't recommend it as it probably has side-effects).


    The problem with the startup-script variant is that that the startup-script gets replaced with the vanilla variant every time the browser is updated (apt-get dist-upgrade), which is quite often. So you have to replace the new startup script with the old one (dangerous), or parse the new one and add your modifications (also dangerous, not to mention work-intensive), or you can just do a binary search and replace on the first occurrence of "geteuid" with "getppid" with a C program (simple, fast, very effective).
    Last edited by WitchCraft; March 31st, 2012 at 11:21 AM.
    In a world without walls and fences, who needs Windows and Gates?
    Linux is like a wigwam.... no Gates, no Windows but Apache inside!
    http://www.debianadmin.com
    apt-get install libstdc++6-4.3-doc

  8. #8
    Join Date
    Apr 2013
    Beans
    1

    Re: Howto run google-chrome as root

    Quote Originally Posted by haqking View Post
    Well as said before it shouldnt be run as root. However if you need to there is no need to hex edit which wont work for all versions, no need to script or edit config files, you only need to append a command to the launcher. If you use icons to launch then append the following the to the command in the launcher
    Code:
    --user-data-dir
    or add it to the command from terminal such as
    Code:
    google-chrome --user-data-dir
    example the properties of the launcher command is as follows
    Code:
    /opt/google/chrome/google-chrome %U
    just change it to be
    Code:
    /opt/google/chrome/google-chrome –user-data-dir %U
    and thats it. Cheers
    This works for me, adding it on launcher command. Thanks!

  9. #9
    Join Date
    Feb 2013
    Beans
    1

    Re: Howto run google-chrome as root

    Thanks.

  10. #10
    Join Date
    Dec 2005
    Beans
    19,325
    Distro
    Ubuntu 13.10 Saucy Salamander

    Re: Howto run google-chrome as root

    Closed. Necromancing.
    Learning is not attained by chance, it must be sought for with ardor and attended to with diligence. Abigail Adams ( 1744 - 1818 ), 1780;

    My blog Poetry and More Free Ubuntu Magazine

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •