写这个文章主要因网上大部分都说在/root/.Xauthority上改。chown xx:xx /root/.Xauthority 。 这里的xx是你登录界面的用户名跟hostname 没多大关系。 我就遇到过这样的问题,改了还是登不上去,出现xserver链接不上。有一次我用#export发现一个
declare -x XAUTHORITY="/home/em/.Xauthority" , 这里的em对应你的登录名。你在去看看属性:
root@em-K40AB:em# ls /home/em/.Xauthority -l
-rw------- 1 root root 155 11月 25 14:46 /home/em/.Xauthority 因此这也要改。
chown em:em /home/em/.Xauthority
在重启就ok了。
========
这里常常出现这个问题的原因是非法关机造成的比较多。