使用 X11 转发的 ssh 静默失败:正在设置显示,但窗口仍然在服务器上打开

使用 X11 转发的 ssh 静默失败:正在设置显示,但窗口仍然在服务器上打开

我只是想将一个简单的 gedit 窗口从一台 Fedora 笔记本电脑转发到另一台。 gedit 命令在“服务器”笔记本电脑上打开 gedit 窗口,而不是在“客户端”笔记本电脑上打开转发的 X11 窗口。

注意:gedit当从客户端执行 ssh 命令时,服务器上没有运行任何实例(该命令确实在服务器上留下了一个实例,因此我在重试之前直接从另一个 ssh 连接终止它)。

服务器/etc/ssh/sshd_config

X11Forwarding yes
X11DisplayOffset 10

客户.ssh/config

ForwardX11 yes
ForwardX11Trusted yes

显示测试命令:

> ssh -X me@server 'echo $DISPLAY'
localhost:10.0

客户端命令:

ssh -vvv -X me@server "/usr/bin/gedit"

命令输出

OpenSSH_8.3p1, OpenSSL 1.1.1i FIPS  8 Dec 2020
debug1: Reading configuration data /home/folio/.ssh/config
debug1: Reading configuration data /etc/ssh/ssh_config
debug3: /etc/ssh/ssh_config line 54: Including file /etc/ssh/ssh_config.d/50-redhat.conf depth 0
debug1: Reading configuration data /etc/ssh/ssh_config.d/50-redhat.conf
debug2: checking match for 'final all' host 10.0.0.5 originally 10.0.0.5
debug3: /etc/ssh/ssh_config.d/50-redhat.conf line 3: not matched 'final'
debug2: match not found
debug3: /etc/ssh/ssh_config.d/50-redhat.conf line 5: Including file /etc/crypto-policies/back-ends/openssh.config depth 1 (parse only)
debug1: Reading configuration data /etc/crypto-policies/back-ends/openssh.config
debug3: gss kex names ok: [gss-curve25519-sha256-,gss-nistp256-sha256-,gss-group14-sha256-,gss-group16-sha512-,gss-gex-sha1-,gss-group14-sha1-,gss-group1-sha1-]
debug3: kex names ok: [curve25519-sha256,[email protected],ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha>
debug1: configuration requests final Match pass
debug2: resolve_canonicalize: hostname 10.0.0.5 is address
debug1: re-parsing configuration
debug1: Reading configuration data /home/folio/.ssh/config
debug1: Reading configuration data /etc/ssh/ssh_config
debug3: /etc/ssh/ssh_config line 54: Including file /etc/ssh/ssh_config.d/50-redhat.conf depth 0
debug1: Reading configuration data /etc/ssh/ssh_config.d/50-redhat.conf
debug2: checking match for 'final all' host 10.0.0.5 originally 10.0.0.5
debug3: /etc/ssh/ssh_config.d/50-redhat.conf line 3: matched 'final'
debug2: match found
debug3: /etc/ssh/ssh_config.d/50-redhat.conf line 5: Including file /etc/crypto-policies/back-ends/openssh.config depth 1
debug1: Reading configuration data /etc/crypto-policies/back-ends/openssh.config
debug3: gss kex names ok: [gss-curve25519-sha256-,gss-nistp256-sha256-,gss-group14-sha256-,gss-group16-sha512-,gss-gex-sha1-,gss-group14-sha1-,gss-group1-sha1-]
debug3: kex names ok: [curve25519-sha256,[email protected],ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha>
debug2: ssh_connect_direct
debug1: Connecting to 10.0.0.5 [10.0.0.5] port 22.
debug1: Connection established.
debug1: identity file /home/folio/.ssh/id_rsa type 0
debug1: identity file /home/folio/.ssh/id_rsa-cert type -1
debug1: identity file /home/folio/.ssh/id_dsa type -1
debug1: identity file /home/folio/.ssh/id_dsa-cert type -1
debug1: identity file /home/folio/.ssh/id_ecdsa type -1
debug1: identity file /home/folio/.ssh/id_ecdsa-cert type -1
debug1: identity file /home/folio/.ssh/id_ecdsa_sk type -1
debug1: identity file /home/folio/.ssh/id_ecdsa_sk-cert type -1
debug1: identity file /home/folio/.ssh/id_ed25519 type -1
debug1: identity file /home/folio/.ssh/id_ed25519-cert type -1
debug1: identity file /home/folio/.ssh/id_ed25519_sk type -1
debug1: identity file /home/folio/.ssh/id_ed25519_sk-cert type -1
debug1: identity file /home/folio/.ssh/id_xmss type -1
debug1: identity file /home/folio/.ssh/id_xmss-cert type -1
debug1: Local version string SSH-2.0-OpenSSH_8.3
debug1: Remote protocol version 2.0, remote software version OpenSSH_8.4
debug1: match: OpenSSH_8.4 pat OpenSSH* compat 0x04000000
debug2: fd 5 setting O_NONBLOCK
debug1: Authenticating to 10.0.0.5:22 as 'bhawkins'
debug3: hostkeys_foreach: reading file "/home/folio/.ssh/known_hosts"
debug3: record_hostkey: found key type ECDSA in file /home/folio/.ssh/known_hosts:8
debug3: load_hostkeys: loaded 1 keys from 10.0.0.5
debug3: order_hostkeyalgs: prefer hostkeyalgs: [email protected],[email protected],ecdsa-sha2-nistp521-cert-v01@op>
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: curve25519-sha256,[email protected],ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sh>
debug2: host key algorithms: [email protected],[email protected],[email protected],ecdsa-sh>
debug2: ciphers ctos: [email protected],[email protected],aes256-ctr,aes256-cbc,[email protected],aes128-ctr,aes128-cbc
debug2: ciphers stoc: [email protected],[email protected],aes256-ctr,aes256-cbc,[email protected],aes128-ctr,aes128-cbc
debug2: MACs ctos: [email protected],[email protected],[email protected],[email protected],hmac-sha2-256,hmac-sha1,umac-1>
debug2: MACs stoc: [email protected],[email protected],[email protected],[email protected],hmac-sha2-256,hmac-sha1,umac-1>
debug2: compression ctos: none,[email protected],zlib
debug2: compression stoc: none,[email protected],zlib
debug2: languages ctos: 
debug2: languages stoc: 
debug2: first_kex_follows 0 
debug2: reserved 0 
debug2: peer server KEXINIT proposal
debug2: KEX algorithms: curve25519-sha256,[email protected],ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sh>
debug2: host key algorithms: rsa-sha2-512,rsa-sha2-256,ssh-rsa,ecdsa-sha2-nistp256,ssh-ed25519
debug2: ciphers ctos: [email protected],[email protected],aes256-ctr,[email protected],aes128-ctr
debug2: ciphers stoc: [email protected],[email protected],aes256-ctr,[email protected],aes128-ctr
debug2: MACs ctos: [email protected],[email protected],[email protected],[email protected],hmac-sha2-256,hmac-sha1,umac-1>
debug2: MACs stoc: [email protected],[email protected],[email protected],[email protected],hmac-sha2-256,hmac-sha1,umac-1>
debug2: compression ctos: none,[email protected]
debug2: compression stoc: none,[email protected]
debug2: languages ctos: 
debug2: languages stoc: 
debug2: first_kex_follows 0 
debug2: reserved 0 
debug1: kex: algorithm: curve25519-sha256
debug1: kex: host key algorithm: ecdsa-sha2-nistp256
debug1: kex: server->client cipher: [email protected] MAC: <implicit> compression: none
debug1: kex: client->server cipher: [email protected] MAC: <implicit> compression: none
debug1: kex: curve25519-sha256 need=32 dh_need=32
debug1: kex: curve25519-sha256 need=32 dh_need=32
debug3: send packet: type 30
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug3: receive packet: type 31
debug1: Server host key: ecdsa-sha2-nistp256 SHA256:+V6XgNHheNBHFL99Ifdm4uNjzraZZBADjytLzbYOueU
debug3: hostkeys_foreach: reading file "/home/folio/.ssh/known_hosts"
debug3: record_hostkey: found key type ECDSA in file /home/folio/.ssh/known_hosts:8
debug3: load_hostkeys: loaded 1 keys from 10.0.0.5
debug1: Host '10.0.0.5' is known and matches the ECDSA host key.
debug1: Found key in /home/folio/.ssh/known_hosts:8
debug3: send packet: type 21
debug2: set_newkeys: mode 1
debug1: rekey out after 4294967296 blocks
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug3: receive packet: type 21
debug1: SSH2_MSG_NEWKEYS received
debug2: set_newkeys: mode 0
debug1: rekey in after 4294967296 blocks
debug1: Will attempt key: /home/folio/.ssh/id_rsa RSA SHA256:59270Q20FVNukCiDfYNCBRFOOYYK/bvUTkL+H9sT518 agent
debug1: Will attempt key: /home/folio/.ssh/id_dsa 
debug1: Will attempt key: /home/folio/.ssh/id_ecdsa 
debug1: Will attempt key: /home/folio/.ssh/id_ecdsa_sk 
debug1: Will attempt key: /home/folio/.ssh/id_ed25519 
debug1: Will attempt key: /home/folio/.ssh/id_ed25519_sk 
debug1: Will attempt key: /home/folio/.ssh/id_xmss 
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,[email protected],ssh-rsa,rsa-sha2-256,rsa-sha2-512,ssh-dss,ecdsa-sha2-nistp256,ecdsa-sha2-nis>
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,gssapi-keyex,gssapi-with-mic,password
debug3: start over, passed a different list publickey,gssapi-keyex,gssapi-with-mic,password
debug3: preferred gssapi-with-mic,publickey,keyboard-interactive,password
debug3: authmethod_lookup gssapi-with-mic
debug3: remaining preferred: publickey,keyboard-interactive,password
debug3: authmethod_is_enabled gssapi-with-mic
debug1: Next authentication method: gssapi-with-mic
debug1: Unspecified GSS failure.  Minor code may provide more information
No Kerberos credentials available (default cache: KCM:)


debug1: Unspecified GSS failure.  Minor code may provide more information
No Kerberos credentials available (default cache: KCM:)


debug2: we did not send a packet, disable method
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/folio/.ssh/id_rsa RSA SHA256:59270Q20FVNukCiDfYNCBRFOOYYK/bvUTkL+H9sT518 agent
debug3: send packet: type 50
debug2: we sent a publickey packet, wait for reply
debug3: receive packet: type 60
debug1: Server accepts key: /home/folio/.ssh/id_rsa RSA SHA256:59270Q20FVNukCiDfYNCBRFOOYYK/bvUTkL+H9sT518 agent
debug3: sign_and_send_pubkey: RSA SHA256:59270Q20FVNukCiDfYNCBRFOOYYK/bvUTkL+H9sT518
debug3: sign_and_send_pubkey: signing using rsa-sha2-256 SHA256:59270Q20FVNukCiDfYNCBRFOOYYK/bvUTkL+H9sT518
debug3: send packet: type 50
debug3: receive packet: type 52
debug1: Authentication succeeded (publickey).
Authenticated to 10.0.0.5 ([10.0.0.5]:22).
debug2: fd 7 setting O_NONBLOCK
debug3: fd 8 is O_NONBLOCK
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 [email protected]
debug3: send packet: type 80
debug1: Entering interactive session.
debug1: pledge: exec
debug3: receive packet: type 80
debug1: client_input_global_request: rtype [email protected] want_reply 0
debug3: receive packet: type 4
debug1: Remote: /home/bhawkins/.ssh/authorized_keys:1: key options: agent-forwarding port-forwarding pty user-rc x11-forwarding
debug3: receive packet: type 4
debug1: Remote: /home/bhawkins/.ssh/authorized_keys:1: key options: agent-forwarding port-forwarding pty user-rc x11-forwarding
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 5 setting TCP_NODELAY
debug3: ssh_packet_set_tos: set IP_TOS 0x48
debug2: client_session2_setup: id 0
debug1: Sending env XMODIFIERS = @im=ibus
debug2: channel 0: request env confirm 0
debug3: send packet: type 98
debug1: Sending env LANG = fr_FR.UTF-8
debug2: channel 0: request env confirm 0
debug3: send packet: type 98
debug1: Sending command: /usr/bin/gedit
debug2: channel 0: request exec 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 99
debug2: channel_input_status_confirm: type 99 id 0
debug2: X11 forwarding 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: exec request accepted on channel 0
debug3: receive packet: type 96
debug2: channel 0: rcvd eof
debug2: channel 0: output open -> drain
debug2: channel 0: obuf empty
debug2: channel 0: chan_shutdown_write (i0 o1 sock -1 wfd 7 efd 8 [write])
debug2: channel 0: output drain -> closed
debug3: receive packet: type 98
debug1: client_input_channel_req: channel 0 rtype exit-status reply 0
debug3: receive packet: type 98
debug1: client_input_channel_req: channel 0 rtype [email protected] reply 0
debug2: channel 0: rcvd eow
debug2: channel 0: chan_shutdown_read (i0 o3 sock -1 wfd 6 efd 8 [write])
debug2: channel 0: input open -> closed
debug3: receive packet: type 97
debug2: channel 0: rcvd close
debug3: channel 0: will not send data after close
debug2: channel 0: almost dead
debug2: channel 0: gc: notify user
debug2: channel 0: gc: user detached
debug2: channel 0: send close
debug3: send packet: type 97
debug2: channel 0: is dead
debug2: channel 0: garbage collecting
debug1: channel 0: free: client-session, nchannels 1
debug3: channel 0: status: The following connections are open:
  #0 client-session (t4 r0 i3/0 o3/0 e[write]/0 fd -1/-1/8 sock -1 cc -1)

debug3: send packet: type 1
debug3: fd 1 is not O_NONBLOCK
debug1: fd 2 clearing O_NONBLOCK
Transferred: sent 3872, received 3272 bytes, in 0.2 seconds
Bytes per second: sent 18702.6, received 15804.4
debug1: Exit status 0

相关内容