Linux, Windows, Virtualization, OpenSource & Blogging

How to run Google Chrome as root on CentOS 7 / RHEL 7

1

In my last post I have shown you how to install Google Chrome on CentOS 7 / RHEL 7; when I tried to start Google Chrome, it gave me the following error.

Run Google Chrome as root on CentOS 7- Google Chrome Startup Error
Run Google Chrome as root on CentOS 7 – Google Chrome Startup Error

 After a long googling, I found an easy way to enable root user to run Google Chrome.

Follow the steps to run Google Chrome as root user in CentOS 7 / RHEL 7.

Open Terminal (Applications –> System Tools –> Terminal).

Edit the /usr/bin/google-chrome and add the –user-data-dirat the end of the last line (Line No: 84).

[root@geeksite~/]# vi /usr/bin/google-chrome

Before

exec < /dev/null 
exec > >(exec cat)
exec 2> >(exec cat >&2)

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

After

exec < /dev/null 
exec > >(exec cat)
exec 2> >(exec cat >&2)

# Note: exec -a below is a bashism.
exec -a "$0" "$HERE/chrome"  "$PROFILE_DIRECTORY_FLAG" \
  "$@" --user-data-dir

That’s all. Now you can start Google Chrome from the menu as root.

POSTS YOU MAY LIKE -:)

You might also like
  • Rafhael Almeida

    dont’ work in RHEL 7.2 x64..
    if [[ -n “$CHROME_USER_DATA_DIR” ]]; then
    # Note: exec -a below is a bashism.
    exec -a “$0” “$HERE/chrome” “$@”
    –user-data-dir=”$CHROME_USER_DATA_DIR” “$@”
    else
    exec -a “$0” “$HERE/chrome” “$@” –user-data-dir
    fi

How to run Google Chrome as root on CentOS 7 / RHEL 7

1