在Ubuntu中使用root用户登录后,再安装chrome浏览器,有时可能出现google chrome can not be run as root的错误。
这时有两个解决方法,可以都试下。
方法1:
以root用户登录后,安装hexedit:
apt-get install hexedit
cp -r /opt/google/chrome/chrome /root/
hexedit chrome
按下回车后,会自动跳到目标所在的地方,接着输入getppid,把原文件中的geteuid换成getppid。
然后按下Ctrl + X保存退出。
接着把修改后的chrome文件复制回原来的地方,覆盖掉原文件:
cp -r /root/chrome /opt/google/chrome/
如果用了上面这个方法后还是会出现这个错误,则在保留上面修改的同时,用下下面的方法。
第二个种方法:
以root身份登陆后,用gedit打开/opt/google/chrome/目录下的google-chrome文件:
gedit /opt/google/chrome/google-chrome
exec -a "$0" "HERE/chrome" "$@"
把这行替换成下面这行:
exec -a "$0" "$HERE/chrome" "$@" --user-data-dir $HOME
保存并退出。
到这里应该就可以了。
google chrome can not be run as root
原文地址:http://blog.csdn.net/liujan511536/article/details/46671361