Hi, I’m trying to use ssh -Y/X ManjaroHost
from my Mac, but get “X11 Forwarding request failed”.
Some experiments I’ve done. To make everything clear, I always ssh from HostA to HostB. HostA is the X server and ssh client, while HostB is the ssh server.
Experiment 1
HostA: My Macbook. HostB: Another Linux cluster.
It works, perfectly, GUI windows will popup on my Mac.
In HostA, echo $DISPLAY → /private/tmp/com.apple.launchd.6AxM1TJrRh/org.xquartz:0
In HostB, echo $DISPLAY → localhost:10.0
So I think my Mac end works good.
Experiment 2
HostA: My Macbook. HostB: Manjaro Linux Lenovo.
HostA: DISPLAY is /private/tmp/com.apple.launchd.6AxM1TJrRh/org.xquartz:0
HostB: DISPLAY is empty.
Here is the debug information from ssh -Yvvv
OpenSSH_9.0p1, LibreSSL 3.3.6
debug1: Reading configuration data /Users/jingchen/.ssh/config
debug1: /Users/jingchen/.ssh/config line 1: Applying options for L
debug1: /Users/jingchen/.ssh/config line 34: Applying options for *
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 21: include /etc/ssh/ssh_config.d/* matched no files
debug1: /etc/ssh/ssh_config line 54: Applying options for *
debug1: /etc/ssh/ssh_config line 58: Applying options for *
debug1: Authenticator provider $SSH_SK_PROVIDER did not resolve; disabling
debug1: auto-mux: Trying existing master
debug1: Control socket "/Users/jingchen/.ssh/master-jingc@lenovo:22" does not exist
debug1: Connecting to lenovo port 22.
debug1: Connection established.
debug1: identity file /Users/jingchen/.ssh/id_rsa_gmail type 0
debug1: identity file /Users/jingchen/.ssh/id_rsa_gmail-cert type -1
debug1: Local version string SSH-2.0-OpenSSH_9.0
debug1: Remote protocol version 2.0, remote software version OpenSSH_9.1
debug1: compat_banner: match: OpenSSH_9.1 pat OpenSSH* compat 0x04000000
debug1: Authenticating to lenovo:22 as 'jingc'
debug1: load_hostkeys: fopen /Users/jingchen/.ssh/known_hosts2: No such file or directory
debug1: load_hostkeys: fopen /etc/ssh/ssh_known_hosts: No such file or directory
debug1: load_hostkeys: fopen /etc/ssh/ssh_known_hosts2: No such file or directory
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: algorithm: sntrup761x25519-sha512@openssh.com
debug1: kex: host key algorithm: ssh-ed25519
debug1: kex: server->client cipher: chacha20-poly1305@openssh.com MAC: <implicit> compression: none
debug1: kex: client->server cipher: chacha20-poly1305@openssh.com MAC: <implicit> compression: none
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug1: SSH2_MSG_KEX_ECDH_REPLY received
debug1: Server host key: ssh-ed25519 SHA256:xxxxxxxxxxxx
debug1: load_hostkeys: fopen /Users/xxxxx/.ssh/known_hosts2: No such file or directory
debug1: load_hostkeys: fopen /etc/ssh/ssh_known_hosts: No such file or directory
debug1: load_hostkeys: fopen /etc/ssh/ssh_known_hosts2: No such file or directory
debug1: Host 'lenovo' is known and matches the ED25519 host key.
debug1: Found key in /Users/jingchen/.ssh/known_hosts:50
debug1: rekey out after 134217728 blocks
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: rekey in after 134217728 blocks
debug1: get_agent_identities: bound agent to hostkey
debug1: get_agent_identities: ssh_fetch_identitylist: agent contains no identities
debug1: Will attempt key: /Users/xxxxx/.ssh/id_rsa_gmail RSA SHA256:BVHEddddddddd explicit
debug1: SSH2_MSG_EXT_INFO received
debug1: kex_input_ext_info: server-sig-algs=<ssh-ed25519,sk-ssh-ed25519@openssh.com,ssh-rsa,rsa-sha2-256,rsa-sha2-512,ssh-dss,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,sk-ecdsa-sha2-nistp256@openssh.com,webauthn-sk-ecdsa-sha2-nistp256@openssh.com>
debug1: kex_input_ext_info: publickey-hostbound@openssh.com=<0>
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey,password
debug1: Next authentication method: publickey
debug1: Offering public key: /Users/xxxxxxx/.ssh/id_rsa_gmail RSA SHA256:xxxxxxxxx1eo explicit
debug1: Authentications that can continue: publickey,password
debug1: Next authentication method: password
jingc@lenovo's password:
Authenticated to lenovo ([192.168.0.183]:22) using "password".
debug1: setting up multiplex master socket
debug1: channel 0: new [/Users/xxxxxx/.ssh/master-jingc@lenovo:22]
debug1: control_persist_detach: backgrounding master process
debug1: forking to background
debug1: Entering interactive session.
debug1: pledge: id
debug1: multiplexing control connection
debug1: channel 1: new [mux-control]
debug1: channel 2: new [client-session]
debug1: client_input_global_request: rtype hostkeys-00@openssh.com want_reply 0
debug1: client_input_hostkeys: searching /Users/xxxx/.ssh/known_hosts for lenovo / (none)
debug1: client_input_hostkeys: searching /Users/xxxx/.ssh/known_hosts2 for lenovo / (none)
debug1: client_input_hostkeys: hostkeys file /Users/xxxx/.ssh/known_hosts2 does not exist
debug1: client_input_hostkeys: host key found matching a different name/address, skipping UserKnownHostsFile update
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
Experiment 3
In case this is because of some internet setup, I tried to ssh -Y 127.0.0.1 in Manjaro Linux Lenovo
HostA = HostB = Manjaro Linux Lenovo
HostA: DISPLAY = :0
HostB (after ssh): DISPLAY is empty
The debug information from ssh -Yvvv is
ssh -Yvvv 127.0.0.1 jing-L
OpenSSH_9.1p1, OpenSSL 1.1.1q 5 Jul 2022
debug1: Reading configuration data /etc/ssh/ssh_config
debug2: resolve_canonicalize: hostname 127.0.0.1 is address
debug3: expanded UserKnownHostsFile '~/.ssh/known_hosts' -> '/home/jingc/.ssh/known_hosts'
debug3: expanded UserKnownHostsFile '~/.ssh/known_hosts2' -> '/home/jingc/.ssh/known_hosts2'
debug3: ssh_connect_direct: entering
debug1: Connecting to 127.0.0.1 [127.0.0.1] port 22.
debug3: set_sock_tos: set socket 3 IP_TOS 0x48
debug1: Connection established.
debug1: identity file /home/jingc/.ssh/id_rsa type 0
debug1: identity file /home/jingc/.ssh/id_rsa-cert type -1
debug1: identity file /home/jingc/.ssh/id_ecdsa type -1
debug1: identity file /home/jingc/.ssh/id_ecdsa-cert type -1
debug1: identity file /home/jingc/.ssh/id_ecdsa_sk type -1
debug1: identity file /home/jingc/.ssh/id_ecdsa_sk-cert type -1
debug1: identity file /home/jingc/.ssh/id_ed25519 type -1
debug1: identity file /home/jingc/.ssh/id_ed25519-cert type -1
debug1: identity file /home/jingc/.ssh/id_ed25519_sk type -1
debug1: identity file /home/jingc/.ssh/id_ed25519_sk-cert type -1
debug1: identity file /home/jingc/.ssh/id_xmss type -1
debug1: identity file /home/jingc/.ssh/id_xmss-cert type -1
debug1: identity file /home/jingc/.ssh/id_dsa type -1
debug1: identity file /home/jingc/.ssh/id_dsa-cert type -1
debug1: Local version string SSH-2.0-OpenSSH_9.1
debug1: Remote protocol version 2.0, remote software version OpenSSH_9.1
debug1: compat_banner: match: OpenSSH_9.1 pat OpenSSH* compat 0x04000000
debug2: fd 3 setting O_NONBLOCK
debug1: Authenticating to 127.0.0.1:22 as 'jingc'
debug3: record_hostkey: found key type ED25519 in file /home/jingc/.ssh/known_hosts:9
debug3: record_hostkey: found key type RSA in file /home/jingc/.ssh/known_hosts:10
debug3: record_hostkey: found key type ECDSA in file /home/jingc/.ssh/known_hosts:11
debug3: load_hostkeys_file: loaded 3 keys from 127.0.0.1
debug1: load_hostkeys: fopen /home/jingc/.ssh/known_hosts2: No such file or directory
debug1: load_hostkeys: fopen /etc/ssh/ssh_known_hosts: No such file or directory
debug1: load_hostkeys: fopen /etc/ssh/ssh_known_hosts2: No such file or directory
debug3: order_hostkeyalgs: have matching best-preference key type ssh-ed25519-cert-v01@openssh.com, using HostkeyAlgorithms verbatim
debug3: send packet: type 20
debug1: SSH2_MSG_KEXINIT sent
debug3: receive packet: type 20
debug1: SSH2_MSG_KEXINIT received
debug2: local client KEXINIT proposal
debug2: KEX algorithms: sntrup761x25519-sha512@openssh.com,curve25519-sha256,curve25519-sha256@libssh.org,ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group16-sha512,diffie-hellman-group18-sha512,diffie-hellman-group14-sha256,ext-info-c
debug2: host key algorithms: ssh-ed25519-cert-v01@openssh.com,ecdsa-sha2-nistp256-cert-v01@openssh.com,ecdsa-sha2-nistp384-cert-v01@openssh.com,ecdsa-sha2-nistp521-cert-v01@openssh.com,sk-ssh-ed25519-cert-v01@openssh.com,sk-ecdsa-sha2-nistp256-cert-v01@openssh.com,rsa-sha2-512-cert-v01@openssh.com,rsa-sha2-256-cert-v01@openssh.com,ssh-ed25519,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,sk-ssh-ed25519@openssh.com,sk-ecdsa-sha2-nistp256@openssh.com,rsa-sha2-512,rsa-sha2-256
debug2: ciphers ctos: chacha20-poly1305@openssh.com,aes128-ctr,aes192-ctr,aes256-ctr,aes128-gcm@openssh.com,aes256-gcm@openssh.com
debug2: ciphers stoc: chacha20-poly1305@openssh.com,aes128-ctr,aes192-ctr,aes256-ctr,aes128-gcm@openssh.com,aes256-gcm@openssh.com
debug2: MACs ctos: umac-64-etm@openssh.com,umac-128-etm@openssh.com,hmac-sha2-256-etm@openssh.com,hmac-sha2-512-etm@openssh.com,hmac-sha1-etm@openssh.com,umac-64@openssh.com,umac-128@openssh.com,hmac-sha2-256,hmac-sha2-512,hmac-sha1
debug2: MACs stoc: umac-64-etm@openssh.com,umac-128-etm@openssh.com,hmac-sha2-256-etm@openssh.com,hmac-sha2-512-etm@openssh.com,hmac-sha1-etm@openssh.com,umac-64@openssh.com,umac-128@openssh.com,hmac-sha2-256,hmac-sha2-512,hmac-sha1
debug2: compression ctos: none,zlib@openssh.com,zlib
debug2: compression stoc: none,zlib@openssh.com,zlib
debug2: languages ctos:
debug2: languages stoc:
debug2: first_kex_follows 0
debug2: reserved 0
debug2: peer server KEXINIT proposal
debug2: KEX algorithms: sntrup761x25519-sha512@openssh.com,curve25519-sha256,curve25519-sha256@libssh.org,ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group16-sha512,diffie-hellman-group18-sha512,diffie-hellman-group14-sha256
debug2: host key algorithms: rsa-sha2-512,rsa-sha2-256,ecdsa-sha2-nistp256,ssh-ed25519
debug2: ciphers ctos: chacha20-poly1305@openssh.com,aes128-ctr,aes192-ctr,aes256-ctr,aes128-gcm@openssh.com,aes256-gcm@openssh.com
debug2: ciphers stoc: chacha20-poly1305@openssh.com,aes128-ctr,aes192-ctr,aes256-ctr,aes128-gcm@openssh.com,aes256-gcm@openssh.com
debug2: MACs ctos: umac-64-etm@openssh.com,umac-128-etm@openssh.com,hmac-sha2-256-etm@openssh.com,hmac-sha2-512-etm@openssh.com,hmac-sha1-etm@openssh.com,umac-64@openssh.com,umac-128@openssh.com,hmac-sha2-256,hmac-sha2-512,hmac-sha1
debug2: MACs stoc: umac-64-etm@openssh.com,umac-128-etm@openssh.com,hmac-sha2-256-etm@openssh.com,hmac-sha2-512-etm@openssh.com,hmac-sha1-etm@openssh.com,umac-64@openssh.com,umac-128@openssh.com,hmac-sha2-256,hmac-sha2-512,hmac-sha1
debug2: compression ctos: none,zlib@openssh.com
debug2: compression stoc: none,zlib@openssh.com
debug2: languages ctos:
debug2: languages stoc:
debug2: first_kex_follows 0
debug2: reserved 0
debug1: kex: algorithm: sntrup761x25519-sha512@openssh.com
debug1: kex: host key algorithm: ssh-ed25519
debug1: kex: server->client cipher: chacha20-poly1305@openssh.com MAC: <implicit> compression: none
debug1: kex: client->server cipher: chacha20-poly1305@openssh.com MAC: <implicit> compression: none
debug3: send packet: type 30
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug3: receive packet: type 31
debug1: SSH2_MSG_KEX_ECDH_REPLY received
debug1: Server host key: ssh-ed25519 SHA256:zI3iykhdxw2IuhorRho
debug3: record_hostkey: found key type ED25519 in file /home/jingc/.ssh/known_hosts:9
debug3: record_hostkey: found key type RSA in file /home/jingc/.ssh/known_hosts:10
debug3: record_hostkey: found key type ECDSA in file /home/jingc/.ssh/known_hosts:11
debug3: load_hostkeys_file: loaded 3 keys from 127.0.0.1
debug1: load_hostkeys: fopen /home/jingc/.ssh/known_hosts2: No such file or directory
debug1: load_hostkeys: fopen /etc/ssh/ssh_known_hosts: No such file or directory
debug1: load_hostkeys: fopen /etc/ssh/ssh_known_hosts2: No such file or directory
debug1: Host '127.0.0.1' is known and matches the ED25519 host key.
debug1: Found key in /home/jingc/.ssh/known_hosts:9
debug3: send packet: type 21
debug2: ssh_set_newkeys: mode 1
debug1: rekey out after 134217728 blocks
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug3: receive packet: type 21
debug1: SSH2_MSG_NEWKEYS received
debug2: ssh_set_newkeys: mode 0
debug1: rekey in after 134217728 blocks
debug1: Will attempt key: /home/jingc/.ssh/id_rsa RSA SHA256:/fu0LTMqDME0x5GFZ+zfIRT3FTODnt9s2pbk7CGpoRg
debug1: Will attempt key: /home/jingc/.ssh/id_ecdsa
debug1: Will attempt key: /home/jingc/.ssh/id_ecdsa_sk
debug1: Will attempt key: /home/jingc/.ssh/id_ed25519
debug1: Will attempt key: /home/jingc/.ssh/id_ed25519_sk
debug1: Will attempt key: /home/jingc/.ssh/id_xmss
debug1: Will attempt key: /home/jingc/.ssh/id_dsa
debug2: pubkey_prepare: done
debug3: send packet: type 5
debug3: receive packet: type 7
debug1: SSH2_MSG_EXT_INFO received
debug1: kex_input_ext_info: server-sig-algs=<ssh-ed25519,sk-ssh-ed25519@openssh.com,ssh-rsa,rsa-sha2-256,rsa-sha2-512,ssh-dss,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,sk-ecdsa-sha2-nistp256@openssh.com,webauthn-sk-ecdsa-sha2-nistp256@openssh.com>
debug1: kex_input_ext_info: publickey-hostbound@openssh.com=<0>
debug3: receive packet: type 6
debug2: service_accept: ssh-userauth
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug3: send packet: type 50
debug3: receive packet: type 51
debug1: Authentications that can continue: publickey,password
debug3: start over, passed a different list publickey,password
debug3: preferred publickey,keyboard-interactive,password
debug3: authmethod_lookup publickey
debug3: remaining preferred: keyboard-interactive,password
debug3: authmethod_is_enabled publickey
debug1: Next authentication method: publickey
debug1: Offering public key: /home/jingc/.ssh/id_rsa RSA SHA256:/fu0LTMqDMxRT3FTODnt9s2pbk7CGpoRg
debug3: send packet: type 50
debug2: we sent a publickey packet, wait for reply
debug3: receive packet: type 51
debug1: Authentications that can continue: publickey,password
debug1: Trying private key: /home/jingc/.ssh/id_ecdsa
debug3: no such identity: /home/jingc/.ssh/id_ecdsa: No such file or directory
debug1: Trying private key: /home/jingc/.ssh/id_ecdsa_sk
debug3: no such identity: /home/jingc/.ssh/id_ecdsa_sk: No such file or directory
debug1: Trying private key: /home/jingc/.ssh/id_ed25519
debug3: no such identity: /home/jingc/.ssh/id_ed25519: No such file or directory
debug1: Trying private key: /home/jingc/.ssh/id_ed25519_sk
debug3: no such identity: /home/jingc/.ssh/id_ed25519_sk: No such file or directory
debug1: Trying private key: /home/jingc/.ssh/id_xmss
debug3: no such identity: /home/jingc/.ssh/id_xmss: No such file or directory
debug1: Trying private key: /home/jingc/.ssh/id_dsa
debug3: no such identity: /home/jingc/.ssh/id_dsa: No such file or directory
debug2: we did not send a packet, disable method
debug3: authmethod_lookup password
debug3: remaining preferred: ,password
debug3: authmethod_is_enabled password
debug1: Next authentication method: password
jingc@127.0.0.1's password:
debug3: send packet: type 50
debug2: we sent a password packet, wait for reply
debug3: receive packet: type 52
Authenticated to 127.0.0.1 ([127.0.0.1]:22) using "password".
debug1: channel 0: new [client-session]
debug3: ssh_session2_open: channel_new: 0
debug2: channel 0: send open
debug3: send packet: type 90
debug1: Requesting no-more-sessions@openssh.com
debug3: send packet: type 80
debug1: Entering interactive session.
debug1: pledge: exec
debug3: receive packet: type 80
debug1: client_input_global_request: rtype hostkeys-00@openssh.com want_reply 0
debug3: client_input_hostkeys: received RSA key SHA256:jVVKNeojhS6f/WBtcnfceUZfQ7eNFrxC6/qzBofzXmU
debug3: client_input_hostkeys: received ECDSA key SHA256:ZctF4busCRJ3DV2k
debug3: client_input_hostkeys: received ED25519 key SHA256:zI3bAMxQnuhorRho
debug1: client_input_hostkeys: searching /home/jingc/.ssh/known_hosts for 127.0.0.1 / (none)
debug3: hostkeys_foreach: reading file "/home/jingc/.ssh/known_hosts"
debug3: hostkeys_find: found ssh-ed25519 key at /home/jingc/.ssh/known_hosts:9
debug3: hostkeys_find: found ssh-rsa key at /home/jingc/.ssh/known_hosts:10
debug3: hostkeys_find: found ecdsa-sha2-nistp256 key at /home/jingc/.ssh/known_hosts:11
debug1: client_input_hostkeys: searching /home/jingc/.ssh/known_hosts2 for 127.0.0.1 / (none)
debug1: client_input_hostkeys: hostkeys file /home/jingc/.ssh/known_hosts2 does not exist
debug3: client_input_hostkeys: 3 server keys: 0 new, 3 retained, 0 incomplete match. 0 to remove
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
It still shows “X11 forwarding request failed on channel 0”
Here is my Manjaro sshd_config file
X11Forwarding yes
X11DisplayOffset 10
X11UseLocalhost no
AllowTcpForwarding yes
AllowAgentForwarding yes
PermitRootLogin yes
ssh_config file
HOST *
#ServerAliveInterval 60
#ServerAliveCountMax 5
ForwardAgent yes
ForwardX11 yes
#ControlPersist yes
ControlMaster auto
ForwardX11Trusted yes
My Mac ssh_config file
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
I think I’ve tried everything I can, but fail to figure out the issue. I really need help.