0%

记录-Centos7下root运行Chrome

Pre:

在Centos7下安装好Chrome浏览器后,root直接运行Chrome的话,会有提示说

Running as root without --no-sandbox is not supported

做法

修改Chrome的启动脚本即可.

1
vi /usr/bin/google-chrome

修改前

1
2
3
4
5
6
7
# processes (http://crbug.com/376567).
exec < /dev/null
exec > >(exec cat)
exec 2> >(exec cat >&2)

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

修改后

1
2
3
4
5
6
7
# processes (http://crbug.com/376567).
exec < /dev/null
exec > >(exec cat)
exec 2> >(exec cat >&2)

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

这个时候就可以用chrome


Refs: