经常需要远程登陆ubuntu服务器上打开浏览器查看一些信息,有时发现VNC登陆上去打不开浏览器
执行firefox直接报错
Running Firefox as root in a regular user's session is not supported. ($HOME is /home/merci which is owned by merci.)
然后重启,关掉vnc进程各种尝试依然不行,于是打算装个谷歌浏览器再试试
wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb sudo dpkg -i google-chrome-stable_current_amd64.deb
然后可以使用google-chrome命令来打开谷歌浏览器,但是依然报错
[2171:2171:1009/111738.056649:ERROR:zygote_host_impl_linux.cc(89)] Running as root without --no-sandbox is not supported. See https://crbug.com/638180.
我们接着继续找找方法,找到/usr/bin/google-chrome文件
sudo vi /usr/bin/google-chrome exec -a "$0" "$HERE/chrome" "$@" 改为 exec -a "$0" "$HERE/chrome" "$@" --user-data-dir --no-sandbox
然后我们再次尝试执行google-chrome,弹出一个提示窗口,直接OK,然后终于弹出了谷歌浏览器的窗口了