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

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

 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.

browsercentos 7google chromerhel 7web browser
Comments (1)
Add Comment
  • 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