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

ADVERTISEMENT

Google Chrome LogoIn my last post i have showed you how to install Google Chrome on CentOS 7 / RHEL 7; when i tried to start Google Chrome it given a following error.

CentOS 7 - Google Chrome Startup Error
CentOS 7 – Google Chrome Startup Error

 After a long googling  i found easy way to enable root user to run Google Chrome.

ADVERTISEMENT
Article will continue after the ad

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

78
79
80
81
82
83
84
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

78
79
80
81
82
83
84
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 menu as root.

ADVERTISEMENT

POSTS YOU MAY LIKE -:)

Share This Post

  • 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

Shares