当我通过 ssh 进入无头 Linux Mint 17 系统时,它不会创建更新/创建 .Xauthority 文件。
此外,当我运行时,xauth我得到了答复:
marty@N40L ~ $ xauth
xauth: file /home/marty/.Xauthority does not exist
Using authority file /home/marty/.Xauthority
xauth>exit
marty@N40L ~ $ xauth
xauth: file /home/marty/.Xauthority does not exist
Using authority file /home/marty/.Xauthority
xauth>
Run Code Online (Sandbox Code Playgroud)
它不会创建文件。
编辑:
当我连接监视器,然后在本地登录时,会创建该文件,但是当我尝试添加一个条目时(因为我的 SSH 不适合我):
marty@N40L ~ $ xauth list
N40L/unix:0 MIT-MAGIC-COOKIE-1 34eee3b15cdb281021502d40dfba1cf2
localhost.localdomain/unix:0 MIT-MAGIC-COOKIE-1 34eee3b15cdb281021502d40dfba1cf2
marty@N40L ~ $ ls -d .X*
-rw------- 1 marty marty 115 Sep 3 12:03 .Xauthority
marty@N40L ~ $ xauth generate $DISPLAY . …Run Code Online (Sandbox Code Playgroud) 使用 MobaXterm 从 Windows 连接到我的 Linux 机器时,我无法在 Windows 端打开 Linux-GUI 应用程序。在 Windows 方面,什么也没有发生。在 Linux 机器上,我收到此错误消息:
MobaXterm X11 proxy: Unsupported authorisation protocol
** ([program]:[processId]): WARNING **: Could not open display localhost:10.0
Run Code Online (Sandbox Code Playgroud) 大家下午好。我是一个没有经验的虚拟机系统管理员,硬件资源有限,安装了 Debian 6。这台机器的主要用途是作为文件服务器/网络服务器,所以我决定不需要浪费资源运行 gnome(以及更一般的 xserver),并且我禁用了 gdm3 在启动时启动。不幸的是,将来一些用户可能需要图形环境,但不会经常证明 xserver 一直在这样的机器上运行是合理的。所以我认为他们可以在需要时启动自己的 xserver。我用 startx 作为简单用户尝试过,我收到了:
xauth: timeout in locking authority file .Xauthority
xauth: timeout in locking authority file .Xauthority
X: user not authorized to run the X server, aborting.
giving up.
Run Code Online (Sandbox Code Playgroud)
我以 root 身份尝试,一切正常。我想避免使用
sudo startx
Run Code Online (Sandbox Code Playgroud)
对于每个用户,因为以这种方式创建的会话以所有 root 权限运行(绕过 sudoers,即使严格配置 - 我试过)。我发现每个普通用户都缺少 .Xauthority 文件。我如何尝试为每个普通用户创建一个?我研究了一下。我尝试了多种 xauth 组合,
xauth generate .
xauth generate :0 . untrusted
xauth generate :0 . trusted
Run Code Online (Sandbox Code Playgroud)
但没有任何成功。它什么也不做或抱怨无法访问 .Xauthority 的事实。问题是 root 是唯一一个拥有 .Xauthority 文件的人......所以我无法从普通用户调用 xauth 并让它工作......。我尝试解决它并更改用户主页中的所有权和权限,但我总是收到 .Xauthority 访问问题。
可能我没有遇到正确方法的问题。Xauth 没有很好的文档记录,从谷歌我总是找到关于如何从普通用户 .Xauthority …
使用登录时,ssh -Y remotehost我收到以下错误消息:
/usr/bin/xauth: /home/hlovdal/.Xauthority 不可写,更改将被忽略
和 xclock 和类似的无法启动。尽管有错误消息,但 .Xauthority 文件的权限没有任何问题。
(hlovdal) remotehost:~>xclock
X11 connection rejected because of wrong authentication.
X11 connection rejected because of wrong authentication.
X11 connection rejected because of wrong authentication.
X11 connection rejected because of wrong authentication.
Error: Can't open display: localhost:10.0
(hlovdal) remotehost:~>ls -l /home/hlovdal/.Xauthority
-rw-------. 1 hlovdal hlovdal 70 Jul 25 23:30 /home/hlovdal/.Xauthority
(hlovdal) remotehost:~>
Run Code Online (Sandbox Code Playgroud)
这里的原因可能是什么?
(这是在我的两台笔记本电脑之间,我之前来回嘘了数百次。)
更新:
在进一步调试时,xauth 再次抱怨它无法写入 .Xauthority 这没有意义,因为我的用户可以写入该文件,出于好奇,我运行了 strace 以查看它究竟试图做什么。
(hlovdal) remotehost:~>xauth list
xauth: /home/hlovdal/.Xauthority not writable, changes …Run Code Online (Sandbox Code Playgroud) 我无法在其中一台服务器上使用 X 应用程序。(同一个客户端成功连接到其他服务器,所以问题不在客户端)。
我连接ssh -vvv -Y -4 jet(也尝试使用-X而不是-Y,同样的问题)强制使用 IPv4(这已经解决了以前的错误)。但是当我启动一个需要 XI 的应用程序时,得到以下信息:
debug1: client_input_channel_open: ctype x11 rchan 3 win 65536 max 16384
debug1: client_request_x11: request from 127.0.0.1 42026
debug2: fd 7 setting O_NONBLOCK
debug3: fd 7 is O_NONBLOCK
debug1: channel 1: new [x11]
debug1: confirm x11
debug2: X11 connection uses different authentication protocol.
X11 connection rejected because of wrong authentication.
debug2: X11 rejected 1 i0/o0
debug2: channel 1: read failed
debug2: channel 1: close_read
debug2: …Run Code Online (Sandbox Code Playgroud) 每当我使用 X11 ssh 从我的 macbook 转发到远程盒子时,我会在几秒钟暂停后收到以下错误:
Warning: untrusted X11 forwarding setup failed: xauth key data not generated
Warning: No xauth data; using fake authentication data for X11 forwarding.
Run Code Online (Sandbox Code Playgroud)
有想法该怎么解决这个吗?
我的网络上所有新安装的CentOS 6.2都有问题。由于与xauth相关的原因,使用X11 gui 软件连接到远程机器失败。我不确定如何诊断,但已将其范围缩小到以下几点:
以下是一些日志:
[ 9273.858] AUDIT: Mon Jun 4 14:41:21 2012: 7778: client 20 connected from local host (
uid=0 gid=0 pid=8800 )
Auth name: MIT-MAGIC-COOKIE-1 ID: 496
[ 9273.870] AUDIT: Mon Jun 4 14:41:21 2012: 7778: client 35 connected from local host (
uid=0 gid=0 pid=8800 )
Auth name: MIT-MAGIC-COOKIE-1 ID: 496
[ 9274.072] AUDIT: Mon Jun 4 14:41:21 2012: 7778: client …Run Code Online (Sandbox Code Playgroud) 当我在本地计算机(Ubuntu 18.10)上运行时,xauth list输出不显示显示编号:
$ xauth list
c7h/unix: MIT-MAGIC-COOKIE-1 37bb744d95232b4e29aea1320b0a0e2d
#ffff#633768#: MIT-MAGIC-COOKIE-1 37bb744d95232b4e29aea1320b0a0e2d
Run Code Online (Sandbox Code Playgroud)
我的环境$DISPLAY变量包含值:1:
$ echo $DISPLAY
:1
Run Code Online (Sandbox Code Playgroud)
所以我期待看到1之后c7h/unix::
c7h/unix:1 MIT-MAGIC-COOKIE-1 37bb744d95232b4e29aea1320b0a0e2d
Run Code Online (Sandbox Code Playgroud)
$XAUTHORITY如果我使用 Python手动解析 env 变量内的文件,该值也会丢失:
if filename is None:
filename = os.environ.get('XAUTHORITY')
if filename is None:
try:
filename = os.path.join(os.environ['HOME'], '.Xauthority')
except KeyError:
raise XConnectionError("$HOME not set, can't find ~/.Xauthority")
try:
xaf = open(filename, 'rb')
raw = xaf.read()
xaf.close()
except IOError as err:
raise XConnectionError("Can't read ~/.Xauthority: %s" % …Run Code Online (Sandbox Code Playgroud)