$ ssh -Xvv remote_host
输出
....
debug1: channel 0: new [client-session]
debug2: channel 0: send open
debug1: Requesting [email protected]
debug1: Entering interactive session.
debug1: pledge: exec
debug1: client_input_global_request: rtype [email protected] want_reply 0
debug1: Remote: /home/user/.ssh/authorized_keys:8: key options: agent-forwarding port-forwarding pty user-rc x11-forwarding
debug1: Remote: /home/user/.ssh/authorized_keys:8: key options: agent-forwarding port-forwarding pty user-rc x11-forwarding
debug2: channel_input_open_confirmation: channel 0: callback start
debug2: x11_get_proto: /usr/bin/xauth list unix:16.0 2>/dev/null
debug1: Requesting X11 forwarding with authentication spoofing.
debug2: channel 0: request x11-req confirm 1
debug2: fd 3 setting TCP_NODELAY
debug2: client_session2_setup: id 0
debug2: channel 0: request pty-req confirm 1
debug1: Sending environment.
debug1: Sending env LANG = en_US.UTF-8
debug2: channel 0: request env confirm 0
debug2: channel 0: request shell confirm 1
debug2: channel_input_open_confirmation: channel 0: callback done
debug2: channel 0: open confirm rwindow 0 rmax 32768
debug2: channel_input_status_confirm: type 100 id 0
X11 forwarding request failed on channel 0
debug2: channel_input_status_confirm: type 99 id 0
debug2: PTY allocation request accepted on channel 0
debug2: channel 0: rcvd adjust 2097152
debug2: channel_input_status_confirm: type 99 id 0
debug2: shell request accepted on channel 0
也试过了-Y
。不起作用。
我确认服务器端允许X11转发。$grep X11 /etc/ssh/sshd_config
给了
X11Forwarding yes
#X11DisplayOffset 10
#X11UseLocalhost yes
我搜索了相关的其他帖子X11 forwarding request failed on channel 0
,但没有找到帮助信息。
答案1
我在 Devuan(没有 systemd 的 Debian 分支)上也遇到了类似的问题。
我发现Arch Wiki 上的解决方案。
编辑/etc/ssh/sshd_config
(在服务器端)并设置:
AddressFamily inet
默认值是AddressFamily any
,但这似乎不提供 inet (ipv4) 套接字。
在我的系统上,我在 /var/log/auth.log 中注意到:
sshd[9184]: error: Failed to allocate internet-domain X11 display socket.
经过上述更改后sshd_config
,service ssh restart
X11 转发对我有用。
答案2
通常当我看到问题标题的错误消息时,这意味着服务器没有xauth
安装包含该命令的软件包,或者守护进程由于某种其他原因sshd
无法使用该命令。xauth