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.

You might also like