X11 転送要求が失敗しました。

X11 転送要求が失敗しました。

ssh -Y/X ManjaroHostMacで試しましたが、「X11転送要求に失敗しました」というメッセージが表示されました。私は今2週間の解決策を探しており、同様の投稿で提案されたいくつかの方法を試しました。私の間違いを指摘すると、多くの助けになります!

以下は私が行ったいくつかの実験です。明確にするために、私は常にHostAからHostBにSSHを介して接続します。 HostA は X サーバーで SSH クライアントで、HostB は SSH サーバーです。

実験1

HostA:私のMacBook。
HostB:別のLinuxクラスタです。
うまく動作し、MacにGUIウィンドウが表示されます。
HostAではecho $DISPLAY --> /private/tmp/com.apple.launchd.6AxM1TJrRh/org.xquartz:0 HostBではecho $DISPLAY --> localhost:10.0 だから私のMac側がとてもうまくいっていると思います。

実験2

HostA:私のMacBook。 HostB:Manjaro Linux Lenovo。
HostA:DISPLAYは/private/tmp/com.apple.launchd.6AxM1TJrRh/org.xquartz:0です。 HostB:DISPLAYは空です。
ssh -Yvvv のデバッグ情報です。

...
...
...
debug1: Requesting X11 forwarding with authentication spoofing.
debug1: Requesting authentication agent forwarding.
debug1: Sending environment.
debug1: channel 2: setting env LC_TERMINAL_VERSION = "3.4.15"
debug1: channel 2: setting env LANG = "en_US.UTF-8"
debug1: channel 2: setting env LC_TERMINAL = "iTerm2"
debug1: mux_client_request_session: master session id: 2
Last login: Wed Nov  9 13:55:34 2022 from 192.168.0.194
X11 forwarding request failed

実験3

いくつかのインターネット設定のために、Manjaro Linux Lenovoでssh -Y 127.0.0.1を試してみました。

ホストA = ホストB = Manjaro Linux Lenovo

ホストA:ディスプレイ=:0

HostB(ssh以降):DISPLAYが空です。

ssh -Yvvvのデバッグ情報は次のとおりです。


 ssh -Yvvv  127.0.0.1                                                           
...
...
...
debug1: client_input_hostkeys: no new or deprecated keys from server
debug3: receive packet: type 91
debug2: channel_input_open_confirmation: channel 0: callback start
debug2: x11_get_proto: /usr/bin/xauth  list :0 2>/dev/null
debug1: Requesting X11 forwarding with authentication spoofing.
debug2: channel 0: request x11-req confirm 1
debug3: send packet: type 98
debug2: fd 3 setting TCP_NODELAY
debug3: set_sock_tos: set socket 3 IP_TOS 0x48
debug2: client_session2_setup: id 0
debug2: channel 0: request pty-req confirm 1
debug3: send packet: type 98
debug2: channel 0: request shell confirm 1
debug3: send packet: type 98
debug2: channel_input_open_confirmation: channel 0: callback done
debug2: channel 0: open confirm rwindow 0 rmax 32768
debug3: receive packet: type 100
debug2: channel_input_status_confirm: type 100 id 0
**X11 forwarding request failed on channel 0**
debug3: receive packet: type 99
debug2: channel_input_status_confirm: type 99 id 0
debug2: PTY allocation request accepted on channel 0
debug2: channel 0: rcvd adjust 2097152
debug3: receive packet: type 99
debug2: channel_input_status_confirm: type 99 id 0
debug2: shell request accepted on channel 0
Last login: Wed Nov  9 14:43:39 2022 from 127.0.0.1

それでも、「チャネル0からX11転送要求が失敗しました」と表示されます。

これは私のManjaro sshd_configファイルです。

X11Forwarding yes
X11DisplayOffset 10
X11UseLocalhost no
AllowTcpForwarding yes
AllowAgentForwarding yes
PermitRootLogin yes

ssh_configファイル

HOST *
    #ServerAliveInterval 60
    #ServerAliveCountMax 5
    ForwardAgent yes
    ForwardX11 yes
    #ControlPersist yes
    ControlMaster auto
    ForwardX11Trusted yes

私のMac ssh_configファイル

HOST *
    ServerAliveInterval 60
    ServerAliveCountMax 5
    ForwardAgent yes
    ForwardX11 yes
    ControlPersist yes
    ControlMaster auto
    ControlPath ~/.ssh/master-%r@%h:%p
    ForwardX11Trusted yes
    identityfile ~/.ssh/id_rsa_gmail

すべての方法を試しましたが、問題を解決できなかったようです。誰でも助けてくれてありがとう!

ベストアンサー1

私の場合、sshクライアントメッセージ「X11転送要求に失敗しました」の理由は、sshデーモン(サーバー上)がIPv6のみを試みたため、ポート6000 +(X11転送ポートの範囲)にバインドできなかったためです。機能しません(ドッカーコンテナにあるため閉じている可能性があります)。

/etc/sshd_config解決策は、1行を次から変更することです:from AddressFamily any(デフォルト)からAddressFamily inet(つまり、いいえinet6)。

おすすめ記事