使用 ForwardX11=yes 时 ssh 锁定

使用 ForwardX11=yes 时 ssh 锁定

为什么这两个都会锁定,并且从不给我提示?

% ssh -X $(hostname) exit
% ssh -o ForwardX11=yes $(hostname) exit

他们都创造了远程控制当前机器上的会话,使用 X11 转发。是的,我知道这很奇怪。有趣的是,将 更改exit为也会锁定,但首先会给我一个文件列表。这意味着锁定与终止 shell 或会话有关,但我只是猜测。此外,如果我删除或 ,ls锁定就会消失。我的-X-o ForwardX11=yes〜/.ssh /配置是空的。如果有帮助的话,下面是使用 运行时选定的一些行-vvv,包括我在最后按 Ctrl-C 时的情况。

% ssh -Xvvv $(hostname) exit
OpenSSH_8.0p1, OpenSSL 1.1.1g FIPS  21 Apr 2020
...
debug1: Connection established.
...
debug1: Local version string SSH-2.0-OpenSSH_8.0
debug1: Remote protocol version 2.0, remote software version OpenSSH_8.0
debug1: match: OpenSSH_8.0 pat OpenSSH* compat 0x04000000
...
debug1: Host 'my-host-name' is known and matches the ECDSA host key.
debug1: Found key in /home/me/.ssh/known_hosts:275
...
debug3: input_userauth_banner
<I see my message of the day here>
...
debug1: Authentication succeeded (publickey).
...
debug1: Entering interactive session.
debug1: pledge: exec  #without -X, this becomes pledge: network
...
debug1: Sending environment.
...
debug1: Sending command: exit
...
debug2: X11 forwarding request accepted on channel 0
...
debug3: fd 7 is O_NONBLOCK
debug1: channel 1: new [x11]
debug1: confirm x11
...
debug3: fd 8 is O_NONBLOCK
debug1: channel 2: new [x11]
debug1: confirm x11
...
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 5 efd 6 [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 4 efd 6 [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 3
debug3: channel 0: status: The following connections are open:
  #0 client-session (t4 r0 i3/0 o3/0 e[write]/0 fd -1/-1/6 sock -1 cc -1)
  #1 x11 (t4 r3 i0/0 o0/0 e[closed]/0 fd 7/7/-1 sock 7 cc -1)
  #2 x11 (t4 r4 i0/0 o0/0 e[closed]/0 fd 8/8/-1 sock 8 cc -1)

^Cdebug3: send packet: type 1
debug1: channel 1: free: x11, nchannels 2
debug3: channel 1: status: The following connections are open:
  #1 x11 (t4 r3 i0/0 o0/0 e[closed]/0 fd 7/7/-1 sock 7 cc -1)
  #2 x11 (t4 r4 i0/0 o0/0 e[closed]/0 fd 8/8/-1 sock 8 cc -1)

debug1: channel 2: free: x11, nchannels 1
debug3: channel 2: status: The following connections are open:
  #2 x11 (t4 r4 i0/0 o0/0 e[closed]/0 fd 8/8/-1 sock 8 cc -1)

debug3: fd 1 is not O_NONBLOCK
Killed by signal 2.

相关内容