How to Install Google Chrome in Kali Linux? – Part 3 – Running Chrome

Continued from How to Install Google Chrome in Kali Linux? – Part 2 – Installation

Running Google Chrome in Kali Linux

You have follow choices to run Google Chrome in Kali Linux:

  1. Run Google Chrome as a Standard user in Kali Linux
  2. Run Google Chrome as Root user in Kali Linux
    • By modifying /opt/google/chrome/google-chrome file
  3. Run Google Chrome as Standard User (while Logged in as root) in Kali Linux
    • Run Google Chrome using gksu
    • Run Google Chrome using sux

Of these 3 options, 1 is the secure most, but somewhat beats the purpose of using Kali Linux in the first place. Option 2 is somewhat a security risk, but then again, you’re probably running IceWeasel/Firefox/Opera and who knows what browser already while signed into your Google account.

Option 3 is probably the best way to go about it.

So let’s get on with it:

Run Google Chrome as a Standard user in Kali Linux

This is self explanatory.

  1. Install Google Chrome in Kali Linux by following either of the choices from this previous post: How to Install Google Chrome in Kali Linux? – Part 2 – Installation
  2. Create a Standard user by following this previous post: How to add remove user (standard user/non-root) in Kali Linux?
  3. Login as your standard user and run Google Chrome in Kali Linux

Pros:

  1. Secured, your standard user (as long it doesn’t have sudo access) wont be able to mess up your system.
  2. You can allow a second user to Google Chrome with with arrangements.

Cons:

  1. Beats the purpose of using Kali Linux, Kali was meant to be run as root user.
  2. Quite annoying switching between users.
  3. We have better options available.

Now you can run Google Chrome in Kali Linux as Standard user.

Run Google Chrome as Root user in Kali Linux

This is the second way of running Google Chrome in Kali Linux. Many will have different views whether it’s a good idea to run as root, but you’re probably running IceWeasel/Firefox/Opera and who knows what browser already while signed into your Google account. So I’ll leave the judgment upto you whether this is what you want to do or not!

Edit required file

leafpad /opt/google/chrome/google-chrome

How to Install Google Chrome in Kali Linux? – Part 2 – Installation - 10 - blackMORE Ops

Go to the end of the file and find this following line:

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

How to Install Google Chrome in Kali Linux? – Part 2 – Installation - 11 - blackMORE Ops

Add -user-data-dir string

Add –user-data-dir at the end of that line. So the new line would look like this:

How to Install Google Chrome in Kali Linux? – Part 2 – Installation - 12 - blackMORE Ops

Save and close the file.

Now you can run Google Chrome from Application > Internet > Google Chrome in Kali Linux as root user.

Run Google Chrome as Standard User (while Logged in as root) in Kali Linux

We can run Google Chrome as Standard User (while Logged in as root) in Kali Linux in two different ways:

  • Run Google Chrome using gksu
  • Run Google Chrome using sux

For both options we need to create a standard user.

Add a non-root standard user:

useradd -m chromeuser

Note: It is very important that you use the -m flag. It creates home directory for the new user which is required to run Google Chrome in Kali Linux. You can follow this guide for a full explanation on how to add/delete a standard user in Kali Linux: How to add remove user (standard user/non-root) in Kali Linux?

How to Install Google Chrome in Kali Linux? – Part 3 – Running Chrome - 1- blackMORE Ops

Run Google Chrome using gksu

gksu  is a frontend to su and gksudo is a frontend to sudo.  Their primary purpose is to run graphical commands that need root without the need to run an X terminal emulator and using su directly.

To run Google Chrome in Kali Linux as a Standard non-root user (while logged in as root) using gksu, type in the following command in terminal window:

gksu -u chromeuser google-chrome

How to Install Google Chrome in Kali Linux? – Part 3 – Running Chrome - 2 - blackMORE Ops

and Voila! you have Google Chrome running in Kali Linux (while logged in as root).

Note: gksudo doesn’t work while logged in as root.

You’ll get this error: (gksudo:19376): GLib-CRITICAL **: g_str_has_prefix: assertion `str != NULL' failed
How to Install Google Chrome in Kali Linux? – Part 3 – Running Chrome - 3 - blackMORE Ops

 

Run Google Chrome using sux

sux is a wrapper around the standard su command which will transfer your X credentials to the target user. This is a much better and cleaner option to run a program as a different user in X while logged in as another. To run Google Chrome in Kali Linux type in the following in terminal window:

sux chromeuser google-chrome

and you have Google Chrome running in root X with non-root user (chromeuser) permission.

Question: How do you know Google Chrome is running as non-root when using gksu or sux?

Excellento! Nice question!

This is how you know Google Chrome in Kali Linux is not running as root user when using gksu or sux.

Type in the following in terminal:

ps ef | grep google-chrome

How to Install Google Chrome in Kali Linux? – Part 3 – Running Chrome - 4 - blackMORE Ops

See Google Chrome is running as UID 1000 in my machine, which is the new non-root user (chromeuser).

Here’s another way you can check

ps aux | grep google-chrome

How to Install Google Chrome in Kali Linux? – Part 3 – Running Chrome - 5 - blackMORE Ops

As you can see we have similar outputs.

That ends this 3 series guide on How to Install Google Chrome in Kali Linux, discussion, installation and running Chrome. Hope you’ve enjoyed reading this guide as much I’ve enjoyed writing it. Please comment with feedback and thanks again for visiting us.

How to Install Google Chrome in Kali Linux? – Part 3 – Running Chrome - 6 - blackMORE Ops

 

 

From comments section: Thanks to Nabil Lion.

Second solution:

Edit the following file

leafpad /opt/google/chrome/google-chrome

Find exec -a “$0″ “$HERE/chrome” “$@”
change as exec -a “$0″ “$HERE/chrome” “$@” –user-data-dir ”/root/.config/google-chrome”
Save and exit file.

 

Thanks for reading. Please share.

Check Also

Correct way of installing VirtualBox Guest Additions in Kali Linux 2016.2/2017 (Kali Rolling)

How to install VirtualBox Guest Additions in Kali Linux (Kali Rolling / Kali Linux 2016.2 / Kali 2017)

Since Kali Linux 2016 came out (also known as Kali Rolling), it seems that Official …

Run Kali Linux in Microsoft Azure on SSD for free - blackMORE Ops - 1

Run Kali Linux in Microsoft Azure on SSD for free

Big news for Kali Linux users, now you can run Kali Linux in Microsoft Azure …

25 comments

  1. i install google chrome but when i open it it still nothing show me

    i use that command for installation dpkg -i google-chrome-stable_current_i386.deb

    tell me what i do now…???

    • Which one did you pick to run Chrome?
      1. Run Google Chrome as a Standard user in Kali Linux
      2. Run Google Chrome as Root user in Kali Linux
      3. Run Google Chrome as Standard User (while Logged in as root) in Kali Linux

  2. Chose Option #3 – Boots up no issues, but there is no sound!! Any suggestions?

  3. Second solution:

    Edit the file /opt/google/chrome/google-chrome

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

    change as exec -a "$0" "$HERE/chrome" "$@" –user-data-dir ”/root/.config/google-chrome”

  4. here what he when to say

    leafpad /opt/google/chrome/google-chrome

    Edit the file /opt/google/chrome/google-chrome

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

    change as exec -a "$0" "$HERE/chrome" "$@" –user-data-dir ”/root/.config/google-chrome”

    • You don’t need to write “/root/.config/google-chrome”
      Everytime you’ll opem chrome that will open the config file. This is what I’ve done:

      changed exec -a “$0” “$HERE/chrome” “$PROFILE_DIRECTORY_FLAG” \ “$@” to

      exec -a “$0” “$HERE/chrome” “$PROFILE_DIRECTORY_FLAG” \ “$@” -user-data-dir

  5. Great tut as always!

    To avoid having to retpye the command every time I saved “gksu -u chromeuser google-chrome” in a text file and named it chrome.sh and put it on my desktop. Don’t forget to make it executable in the properties

  6. Pls help :3
    I can’t open Google Chrome, wether it is with second way or the third way (I don’t want to use the first one).

    If I use
    gksu -u chromeuser google-chrome
    , it always says:

    glibtop: Non-standard uts for running kernel:
    release 3.14-kali1-686-pae=3.14.0 gives version code 200192

    Segmentation fault

    If I open it from Applications >> Internet >> Google Chrome, then it won’t open.

    This is the content of my /opt/google/chrome/google-chrome:

    #!/bin/bash
    #
    # Copyright (c) 2011 The Chromium Authors. All rights reserved.
    # Use of this source code is governed by a BSD-style license that can be
    # found in the LICENSE file.

    # Let the wrapped binary know that it has been run through the wrapper.
    export CHROME_WRAPPER=”`readlink -f “$0″`”

    HERE=”`dirname “$CHROME_WRAPPER”`”

    # Check if the CPU supports SSE2. If not, try to pop up a dialog to explain the
    # problem and exit. Otherwise the browser will just crash with a SIGILL.
    # http://crbug.com/348761
    grep ^flags /proc/cpuinfo|grep -qs sse2
    if [ $? != 0 ]; then
    SSE2_DEPRECATION_MSG=”This computer can no longer run Google Chrome because \
    its hardware is no longer supported.”
    if which zenity &> /dev/null; then
    zenity –warning –text=”$SSE2_DEPRECATION_MSG”
    elif which gmessage &> /dev/null; then
    gmessage “$SSE2_DEPRECATION_MSG”
    elif which xmessage &> /dev/null; then
    xmessage “$SSE2_DEPRECATION_MSG”
    else
    echo “$SSE2_DEPRECATION_MSG” 1>&2
    fi
    exit 1
    fi

    # We include some xdg utilities next to the binary, and we want to prefer them
    # over the system versions when we know the system versions are very old. We
    # detect whether the system xdg utilities are sufficiently new to be likely to
    # work for us by looking for xdg-settings. If we find it, we leave $PATH alone,
    # so that the system xdg utilities (including any distro patches) will be used.
    if ! which xdg-settings &> /dev/null; then
    # Old xdg utilities. Prepend $HERE to $PATH to use ours instead.
    export PATH=”$HERE:$PATH”
    else
    # Use system xdg utilities. But first create mimeapps.list if it doesn’t
    # exist; some systems have bugs in xdg-mime that make it fail without it.
    xdg_app_dir=”${XDG_DATA_HOME:-$HOME/.local/share/applications}”
    mkdir -p “$xdg_app_dir”
    [ -f “$xdg_app_dir/mimeapps.list” ] || touch “$xdg_app_dir/mimeapps.list”
    fi

    # Always use our versions of ffmpeg libs.
    # This also makes RPMs find the compatibly-named library symlinks.
    if [[ -n “$LD_LIBRARY_PATH” ]]; then
    LD_LIBRARY_PATH=”$HERE:$HERE/lib:$LD_LIBRARY_PATH”
    else
    LD_LIBRARY_PATH=”$HERE:$HERE/lib”
    fi
    export LD_LIBRARY_PATH

    export CHROME_VERSION_EXTRA=”stable”

    # We don’t want bug-buddy intercepting our crashes. http://crbug.com/24120
    export GNOME_DISABLE_CRASH_DIALOG=SET_BY_GOOGLE_CHROME

    # Automagically migrate user data directory.
    # TODO(phajdan.jr): Remove along with migration code in the browser for M33.
    if [[ -n “” ]]; then
    if [[ ! -d “” ]]; then
    “$HERE/chrome” “–migrate-data-dir-for-sxs=” \
    –enable-logging=stderr –log-level=0
    fi
    fi

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

    # Make sure that the profile directory specified in the environment, if any,
    # overrides the default.
    if [[ -n “$CHROME_USER_DATA_DIR” ]]; then
    PROFILE_DIRECTORY_FLAG=”–user-data-dir=$CHROME_USER_DATA_DIR”
    fi

    # Sanitize std{in,out,err} because they’ll be shared with untrusted child
    # processes (http://crbug.com/376567).
    exec >(exec cat)
    exec 2> >(exec cat >&2)

    # Note: exec -a below is a bashism.
    exec -a “$0” “$HERE/chrome” “$PROFILE_DIRECTORY_FLAG” \
    “$@”

    I tried Nabil’s, and Siddharth Shankars’s solution, but it won’t work.

  7. Solution 2: “Run Google Chrome as Root user in Kali Linux” with adding –user-data-dir worked perfect for me (64 bit Kali) untill version google-chrome-stable 42.0.2311.90-1 . Now it stop working: no pop-up window, nothing… Now I’m using Solution 3: Run Google Chrome as Standard User (while Logged in as root) in Kali Linux, with “gksu -u chromeuser google-chrome”, but I like much more previous solution. Any help?

    • I am also facing the same issue after upgrading the browser version to 42.0.2311.90-1. Is this a kind of known bug and is google team working towards resolving the issue or we have forget using google chrome on Kali and look for an alternative??

      • I don’t thing this is a “bug”. It’s done with purpose – runing chrome as a root is not safe for “normal” linux user. But Kali is not a “normal” distro and kali is created to be run as a root. So the solution is in the hands of Kali community…

        • Dead readers,
          If you ask me personally, I just don’t see the point of running Google Chrome in Kali or any security Linux distro. Chromium is exactly same and supports every plugins, extensions etc. It’s well supported, available in repo. Hell, you could even download a theme to make it look like Chrome.
          apt-get install chromium and you’re all set.
          Google tracks everything and it Chrome defeats the purpose of running a security distro.
          I am not taking any credit away from anyone, but if you are into security, Opera/IceWeasel (for IceWeasel vs Firefox, exactly the same arguments written above) is by far a better choice in Kali, less hassle, less dramas and things just works.
          For example, in Windows (yeah I do still use that, blame me!) I used Comodo Browser which is a fork of Chromium. Runs and worked just fine.
          As for this issue, I will test it ASAP. I am just one person doing everything including administering this server, so please excuse the delay. Cheers,
          -BMO

  8. i install google chrome but when i open it it still nothing show me

    i use that command for installation dpkg -i google-chrome-stable_current_i386.deb

    tell me what i do now…??? please help

    • have you tried gksu -u with a non-root user, or try adding –no-sandbox at the end, though i recommend gksu instead of no sandbox, as running chrome with no sandbox is a major security risk.

      in my case, all my chrome shortcuts(in the internet tap, and in quick launch) are the following “gksu -u chromeuser google-chrome”
      where chromeuser is a nonroot user i have created, just to have a non root user for things, but it runs much more than just chrome.(since i like to play games for fun as well, and have a doom clone installed)

  9. I do the dpkg -i command and I get this:
    root@KaliLinux:~# cd Desktop
    root@KaliLinux:~/Desktop# dpkg -i google-chrome-stable_current_amd64.deb
    Selecting previously unselected package google-chrome-stable.
    (Reading database … 325433 files and directories currently installed.)
    Unpacking google-chrome-stable (from google-chrome-stable_current_amd64.deb) …
    dpkg: dependency problems prevent configuration of google-chrome-stable:
    google-chrome-stable depends on libappindicator1; however:
    Package libappindicator1 is not installed.

    dpkg: error processing google-chrome-stable (–install):
    dependency problems – leaving unconfigured
    Processing triggers for man-db …
    Processing triggers for desktop-file-utils …
    Processing triggers for gnome-menus …
    Processing triggers for menu …
    Errors were encountered while processing:
    google-chrome-stable
    root@KaliLinux:~/Desktop#
    Please help.

    • do you have libappindicator1 installed? try running apt-get install libappindicator1 and see what happens.

  10. no sound in google-chrome , i tried but does not work usermod -a -G audio chromeuser

    • is your non-root user called chromeuser? if not, it will not work. so far that command has made mine work fine, in terms of audio.

  11. as I can install chrome in kali linux 2.0

  12. Hi, while installing from both apt-get or .deb file,i am getting depends on libappindicator1, but it is not installable error in Kali Linux 2.0 and chrome version in 44.

  13. run apt-get -f install

  14. You need to be a part of a contest for one of the most useful
    sites on the net. I am going to highly recommend this blog!

Leave a Reply

Your email address will not be published. Required fields are marked *