这个剧本在做什么?
#!/bin/bash
xhost +local:
xhost +si:localuser:root
xhost
的默认列表是什么?
发布于 2017-01-30 08:31:05
xhost +SI:localuser:root
允许root
用户访问正在运行的X服务器。当前的X服务器由DISPLAY
环境变量指示。xhost +local:
对每个用户都这样做,因此root
行没有多大用处。
命令页有相当好的解释:
[+]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:
...
local contains only one name, the empty string
si Server Interpreted
...
The local family specifies all the local connections at once. However,
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.)
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
是一个需要保留的关键字(root
是这里的用户名)。这有点像添加到组中,因为组在服务器对授权的理解中。但是,不影响系统组或用户。只更改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
(muru
是我的用户名。)
https://askubuntu.com/questions/877820
复制相似问题