这个脚本在做什么?
#!/bin/bash
xhost +local:
xhost +si:localuser:root
Run Code Online (Sandbox Code Playgroud)
什么是默认列表xhost?
mur*_*uru 17
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.)
Run Code Online (Sandbox Code Playgroud)
手册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
Run Code Online (Sandbox Code Playgroud)
有一点上下文:有两种常用的方法来允许访问 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.
Run Code Online (Sandbox Code Playgroud)
例如:
$ xhost
access control enabled, only authorized clients can connect
SI:localuser:muru
Run Code Online (Sandbox Code Playgroud)
(muru是我的用户名。)
| 归档时间: |
|
| 查看次数: |
19120 次 |
| 最近记录: |