请帮助我理解这条命令:
xhost +SI:localuser:lightdm在参考本篇文章的答案中,并建议是否有更好的方法,以及为什么需要这样做。我无法从手册页面中赚到很多,所以我希望有一些更详细的答案来使它变得简单。(我是否应该用我的用户名替换本地用户,这是否类似于添加到组中?我知道+是加法的意思,但不懂SI或si !)
还请说明如何将用户添加到“允许建立连接的列表”中,以及这意味着什么。还有,我是如何检查当前列表的?
发布于 2015-01-05 15:56:36
xhost +SI:localuser:lightdm允许lightdm用户访问正在运行的X服务器。当前的X服务器由DISPLAY环境变量指示。
命令页有相当好的解释:
[+]name The given name (the plus sign is optional) is added to the list
allowed to connect to the X server. The name can be a host
name or a complete name (See NAMES for more details).
...
NAMES
A complete name has the syntax ``family:name'' where the families are
as follows:
...
si Server Interpreted
...
the server interpreted address "si:localuser:username" can be used to
specify a single local user. (See the Xsecurity(7) manual page for more
details.)Xsecurity命令页说:
SERVER INTERPRETED ACCESS TYPES
The sample implementation includes several Server Interpreted
mechanisms:
IPv6 IPv6 literal addresses
hostname Network host name
localuser Local connection user id
localgroup Local connection group id有一点上下文:有两种常用的方式允许访问X服务器。一种是通过Xauthority文件,该文件由客户端共享,不需要进一步的服务器端配置。另一个是通过xhost列表,配置是在运行时在服务器上完成的(所以这不是一个永久的更改)。
因此,localuser是一个要按原样保留的关键字(lightdm是此处的用户名,LightDM运行的那个用户名)。这有点像添加到组中,因为组在服务器对授权的理解中。但是,不影响系统组或用户。只更改X服务器的运行时配置。
在没有参数的情况下运行xhost的默认行为是打印列表,如手册中所述:
nothing If no command line arguments are given, a message indicating
whether or not access control is currently enabled is printed,
followed by the list of those allowed to connect. 例如:
$ xhost
access control enabled, only authorized clients can connect
SI:localuser:muru我们可能需要检查代码,以确定用户是如何添加到列表中的,以及X是如何使用该列表的。
这样做的原因是使用gsettings,后者使用dbus,而后者通常需要运行X服务器。但是,这是不必要的,您可以看到这个AskUbuntu的答案。
https://unix.stackexchange.com/questions/177557
复制相似问题