缺少Ubuntu 17.10中的〜/ .Xauthority文件

在Ubuntu 17.10中,当我使用Wayland登录并尝试使用root访问权限运行GUI应用程序时,它说

unable to copy the user's xauthorization file 

我试过了

 sudo chown sharif:sharif ~/.Xauthority 

但结果是

 chown: cannot access '/home/sharif/.Xauthority': No such file or directory 

但在Xorg中,这些应用程序运行良好。

查看https://bugs.launchpad.net/ubuntu/+source/synaptic/+bug/1551951 ,并在评论#9中找到解决方法。 特别是:

pkexec用于授予root的方法(即用户运行其参数为)对真实用户的X显示的访问在Wayland下不起作用,但仍然使用X(即使用Xwayland)。 Xwayland(至少由mutter / gnome-shell启动)在没有“-auth”选项的情况下启动,因此只允许访问真实用户(采用Wayland的安全模型)。 因此,没有Xauthority文件可以授予其他用户访问权限。 解决方法是明确允许root用户访问用户的X显示

$ xhost + si:localuser:root

我刚刚在我的Artful和synaptic的安装上尝试了这个,最后成功运行了。 Gparted提出了一些斗争,但也在第二次尝试成功。

上述解决方案适用于每个会话。 该主题中的注释#13显示了每次登录时如何粘贴它。

17.10默认使用wayland,而不是x11; 因此,没有.xauthority文件。

此外,默认情况下,root不允许访问您的终端; 因此,无法运行GUI程序。