Ubuntu运行Chrome出现“Google Chrome can not be run as root”的解决方法
Google Chrome can not be run as root.
Please start Google Chrome as a normal user. To run as root, you must specify an alternate –user-data-dir for storage of profile information.
Please start Google Chrome as a normal user. To run as root, you must specify an alternate –user-data-dir for storage of profile information.
意思是Chrome不允许在root下运行,由于这是VPS不是自家电脑,因此换用户有点蛋疼,寻觅网络试过很多方法,比如修改FLAGS之类的都失败,最后找到个不错的方法,在此分享下。
首先需要安装十六进制编辑器
# apt-get -y install hexedit
然后使用编辑器编辑Chrome
# hexedit /opt/google/chrome/chrome
注意:路径如果不同的话请自行使用dpkg -c 安装包来察看安装到哪里了。
进入到编辑器后,光标在左侧,首先按TAB键切换到右侧的ASCII码模式,接着按Ctrl+S打开搜索功能,输入geteuid查找,当光标停到首字母的地方后,直接输入getppid就能修改了,最后按Ctrl+X保存退出。
重新打开Chrome,正常运行。
后记:不仅是Chrome,Chromium也同样适用,不过相对文件位置有所不同。
对于fedora,同样有效。