我设置的 xauth 足以获得 xterm、xclock 等。但是任何其他程序(如 gnome-terminal、浏览器)仍然无法进行身份验证。两台计算机具有相同的用户名和默认 ID 1000 和组 1000。
虽然我相信 xauth 部分工作,但我在xhost +
客户端上进行了快速测试,结果如下。
这是需要修复的错误:
client$ ssh -X server
...
server$ gnome-terminal
X11 connection rejected because of wrong authentication.
Error creating terminal: No screen 0 on display "localhost:10.0"
# But this works and shows the xterm window on the client.
$ xterm
# Pop!_OS ubuntu 21.10
client$ egrep X11 /etc/ssh/ssh_config
/etc/ssh/ssh_config: ForwardX11 yes
/etc/ssh/ssh_config:# ForwardX11Trusted yes
client$ xauth list
client/unix: MIT-MAGIC-COOKIE-1 <<HEX SECRET A>>
#ffff#abcdef012345#: MIT-MAGIC-COOKIE-1 <<HEX SECRET A>>
client$ echo $XAUTHORITY
/run/user/1000/gdm/Xauthority
# There is no ~/.Xauthority
# Debian GNU/Linux 9 (stretch)
server$ egrep X11 /etc/ssh/sshd_config
/etc/ssh/sshd_config:X11Forwarding yes
/etc/ssh/sshd_config:#X11DisplayOffset 10
/etc/ssh/sshd_config:#X11UseLocalhost yes
/etc/ssh/sshd_config:# X11Forwarding no
server$ echo $DISPLAY
localhost:10.0
server$ xauth list
server/unix:10 MIT-MAGIC-COOKIE-1 <<HEX SECRET B>>
# ~/.Xauthority is 52 bytes and owned by 1000:1000
# On the server XAUTHORITY is not setup automatically. It does not
# matter if I `export XAUTHORITY=$HOME/.Xauthority` in the ssh session.
十六进制秘密 A 和 B 不匹配(不确定它们是否也需要)。