当我不使用 ForwardX11 变量 (-Y) 时,ssh 连接会卡住

阿尔珀

当我尝试ssh连接到远程机器时,如果我不使用 ForwardX11 变量作为-Y. 终端冻结,我无法取消操作,我必须关闭终端才能退出。

造成这种问题的主要原因是什么?

可以ssh在不使用 ForwardX11 变量的情况下自动尝试另一种方法来进行新的连接尝试或强制连接吗?


我的调试输出:

ssh连接期间冻结的尝试

$ ssh -v user@IP

OpenSSH_8.1p1, LibreSSL 2.7.3
debug1: Reading configuration data /Users/alper/.ssh/config
debug1: /Users/alper/.ssh/config line 9: Applying options for *
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 47: Applying options for *
debug1: /etc/ssh/ssh_config line 51: Applying options for *
debug1: Connecting to 192.168.1.8 [192.168.1.8] port 22.
debug1: Connection established.
debug1: identity file /Users/alper/.ssh/id_rsa type 0
debug1: identity file /Users/alper/.ssh/id_rsa-cert type -1
debug1: identity file /Users/alper/.ssh/id_dsa type -1
debug1: identity file /Users/alper/.ssh/id_dsa-cert type -1
debug1: identity file /Users/alper/.ssh/id_ecdsa type -1
debug1: identity file /Users/alper/.ssh/id_ecdsa-cert type -1
debug1: identity file /Users/alper/.ssh/id_ed25519 type -1
debug1: identity file /Users/alper/.ssh/id_ed25519-cert type -1
debug1: identity file /Users/alper/.ssh/id_xmss type -1
debug1: identity file /Users/alper/.ssh/id_xmss-cert type -1
debug1: Local version string SSH-2.0-OpenSSH_8.1
debug1: Remote protocol version 2.0, remote software version OpenSSH_8.2p1 Ubuntu-4ubuntu0.2
debug1: match: OpenSSH_8.2p1 Ubuntu-4ubuntu0.2 pat OpenSSH* compat 0x04000000
debug1: Authenticating to 192.168.1.8:22 as 'alper'
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
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: expecting SSH2_MSG_KEX_ECDH_REPLY
debug1: Server host key: ecdsa-sha2-nistp256 SHA256:ukLpqw3yNMx9D29UnmY5rSJRc6Y0ENlAK2R2DNjyljY
debug1: Host '192.168.1.8' is known and matches the ECDSA host key.
debug1: Found key in /Users/alper/.ssh/known_hosts:51
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: Will attempt key: /Users/alper/.ssh/id_rsa RSA SHA256:5HDbKAE8ePtTuGB48GSxWzeykOSUKKO5fxG2ub7YTvc
debug1: Will attempt key: /Users/alper/.ssh/id_dsa
debug1: Will attempt key: /Users/alper/.ssh/id_ecdsa
debug1: Will attempt key: /Users/alper/.ssh/id_ed25519
debug1: Will attempt key: /Users/alper/.ssh/id_xmss
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-nistp384,ecdsa-sha2-nistp521,[email protected]>
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey,password
debug1: Next authentication method: publickey
debug1: Offering public key: /Users/alper/.ssh/id_rsa RSA SHA256:5HDbKAE8ePtTuGB48GSxWzeykOSUKKO5fxG2ub7YTvc
debug1: Server accepts key: /Users/alper/.ssh/id_rsa RSA SHA256:5HDbKAE8ePtTuGB48GSxWzeykOSUKKO5fxG2ub7YTvc
debug1: Authentication succeeded (publickey).
Authenticated to 192.168.1.8 ([192.168.1.8]:22).
debug1: channel 0: new [client-session]
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/alper/.ssh/authorized_keys:1: key options: agent-forwarding port-forwarding pty user-rc x11-forwarding
debug1: Remote: /home/alper/.ssh/authorized_keys:1: key options: agent-forwarding port-forwarding pty user-rc x11-forwarding

工作连接:

$ ssh -Yv user@IP
OpenSSH_8.1p1, LibreSSL 2.7.3
debug1: Reading configuration data /Users/alper/.ssh/config
debug1: /Users/alper/.ssh/config line 9: Applying options for *
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 47: Applying options for *
debug1: /etc/ssh/ssh_config line 51: Applying options for *
debug1: Connecting to 192.168.1.8 [192.168.1.8] port 22.
debug1: Connection established.
debug1: identity file /Users/alper/.ssh/id_rsa type 0
debug1: identity file /Users/alper/.ssh/id_rsa-cert type -1
debug1: identity file /Users/alper/.ssh/id_dsa type -1
debug1: identity file /Users/alper/.ssh/id_dsa-cert type -1
debug1: identity file /Users/alper/.ssh/id_ecdsa type -1
debug1: identity file /Users/alper/.ssh/id_ecdsa-cert type -1
debug1: identity file /Users/alper/.ssh/id_ed25519 type -1
debug1: identity file /Users/alper/.ssh/id_ed25519-cert type -1
debug1: identity file /Users/alper/.ssh/id_xmss type -1
debug1: identity file /Users/alper/.ssh/id_xmss-cert type -1
debug1: Local version string SSH-2.0-OpenSSH_8.1
debug1: Remote protocol version 2.0, remote software version OpenSSH_8.2p1 Ubuntu-4ubuntu0.2
debug1: match: OpenSSH_8.2p1 Ubuntu-4ubuntu0.2 pat OpenSSH* compat 0x04000000
debug1: Authenticating to 192.168.1.8:22 as 'alper'
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
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: expecting SSH2_MSG_KEX_ECDH_REPLY
debug1: Server host key: ecdsa-sha2-nistp256 SHA256:ukLpqw3yNMx9D29UnmY5rSJRc6Y0ENlAK2R2DNjyljY
debug1: Host '192.168.1.8' is known and matches the ECDSA host key.
debug1: Found key in /Users/alper/.ssh/known_hosts:51
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: Will attempt key: /Users/alper/.ssh/id_rsa RSA SHA256:5HDbKAE8ePtTuGB48GSxWzeykOSUKKO5fxG2ub7YTvc
debug1: Will attempt key: /Users/alper/.ssh/id_dsa
debug1: Will attempt key: /Users/alper/.ssh/id_ecdsa
debug1: Will attempt key: /Users/alper/.ssh/id_ed25519
debug1: Will attempt key: /Users/alper/.ssh/id_xmss
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-nistp384,ecdsa-sha2-nistp521,[email protected]>
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey,password
debug1: Next authentication method: publickey
debug1: Offering public key: /Users/alper/.ssh/id_rsa RSA SHA256:5HDbKAE8ePtTuGB48GSxWzeykOSUKKO5fxG2ub7YTvc
debug1: Server accepts key: /Users/alper/.ssh/id_rsa RSA SHA256:5HDbKAE8ePtTuGB48GSxWzeykOSUKKO5fxG2ub7YTvc
debug1: Authentication succeeded (publickey).
Authenticated to 192.168.1.8 ([192.168.1.8]:22).
debug1: channel 0: new [client-session]
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/alper/.ssh/authorized_keys:1: key options: agent-forwarding port-forwarding pty user-rc x11-forwarding
debug1: Remote: /home/alper/.ssh/authorized_keys:1: key options: agent-forwarding port-forwarding pty user-rc x11-forwarding
debug1: Requesting X11 forwarding with authentication spoofing.
debug1: Requesting authentication agent forwarding.
debug1: Sending environment.
debug1: Sending env LC_TERMINAL_VERSION = 3.4.20210315-nightly
debug1: Sending env LC_CTYPE = en_US.UTF-8
debug1: Sending env LC_TERMINAL = iTerm2
debug1: Sending env LC_ALL = en_US.UTF-8
debug1: Sending env LANG = en_US.UTF-8
用户1686

造成这种问题的主要原因是什么?

很可能在您的 ~/.bashrc、~/.bash_profile 或 ~/.profile 中有一些东西试图运行基于 X11 的程序。这可能是您为本地登录添加的一些代码,没有正确检查是否设置了 $DISPLAY。

ssh 能否在不使用 ForwardX11 变量的情况下自动尝试另一种方法来进行新的连接尝试或强制连接?

不会。据ssh所知,连接成功——服务器已经接受了通道请求和一切。只是远程端没有向您发送任何文本,但这在技术上没有问题,就像在黑色中录制视频没有任何问题一样。

本文收集自互联网,转载请注明来源。

如有侵权,请联系[email protected] 删除。

编辑于
0

我来说两句

0条评论
登录后参与评论

相关文章

来自分类Dev

解决:即使使用ViewHolder,ListView也无法平滑滚动,滚动时也会卡住/破裂

来自分类Dev

使用__VA_ARGS__从宏调用函数时,为什么“ vsprintf”会卡住?

来自分类Dev

禁用ForwardX11Timeout而不在OpenSSH Client中信任ForwardX11吗?

来自分类Dev

当我使用变量时,sed无法正常工作

来自分类Dev

当我使用变量时,抓取不会转移

来自分类Dev

当我使用变量String时,更改alertDialog标题的颜色

来自分类Dev

SSH,建立连接,但卡住

来自分类Dev

当我不使用引号时,argc如何工作?

来自分类Dev

为什么我的while循环有时会卡住,而有时却不会出现在“秘密圣诞老人”程序中?

来自分类Dev

当我尝试在.each函数之外使用变量时,变量变为Nan

来自分类Dev

C-为什么使用uint64_t计数器时for循环会卡住,而while循环却不会?

来自分类Dev

当我使用“ ng-list”时,我无法在javascript中访问变量模型

来自分类Dev

当我使用我之前声明的全局变量时,eslint 显示错误

来自分类Dev

当我使用 onClick 箭头函数时,为什么我的变量未定义?

来自分类Dev

为什么当我使用 SwingWorker 时我的图像没有下载,而当我不使用时却下载?

来自分类Dev

使用变量时不使用索引

来自分类Dev

当我使用[=]捕获(使用Lambda类)时,为什么变量变成'const'?

来自分类Dev

尝试使用SSH本地时重置连接

来自分类Dev

使用python连接SSH时出错

来自分类Dev

为什么当我尝试连接反向ssh时将其关闭?

来自分类Dev

当我尝试“ ssh localhost”或“ source〜/ .bashrc”时,“无法连接到X服务器”

来自分类Dev

当我尝试关闭 ssh2 连接时,没有回复

来自分类Dev

当我使用变量进行比较时,JavaScript不足以失败

来自分类Dev

当我使用变量作为参数时,为什么fromRaw()返回nil?

来自分类Dev

当我尝试使用对象分解导致的变量TS无法识别其类型时

来自分类Dev

当我使用var和rgba时,css变量在scss中不起作用

来自分类Dev

当我使用2个baseImages时,无法在Dockerfile中传递环境变量

来自分类Dev

当我想使用JSONDecoder()解码数据时,某些变量返回nil

来自分类Dev

Tkinter-当我尝试打印使用Entry定义的变量时,打印返回“。!entry”

Related 相关文章

  1. 1

    解决:即使使用ViewHolder,ListView也无法平滑滚动,滚动时也会卡住/破裂

  2. 2

    使用__VA_ARGS__从宏调用函数时,为什么“ vsprintf”会卡住?

  3. 3

    禁用ForwardX11Timeout而不在OpenSSH Client中信任ForwardX11吗?

  4. 4

    当我使用变量时,sed无法正常工作

  5. 5

    当我使用变量时,抓取不会转移

  6. 6

    当我使用变量String时,更改alertDialog标题的颜色

  7. 7

    SSH,建立连接,但卡住

  8. 8

    当我不使用引号时,argc如何工作?

  9. 9

    为什么我的while循环有时会卡住,而有时却不会出现在“秘密圣诞老人”程序中?

  10. 10

    当我尝试在.each函数之外使用变量时,变量变为Nan

  11. 11

    C-为什么使用uint64_t计数器时for循环会卡住,而while循环却不会?

  12. 12

    当我使用“ ng-list”时,我无法在javascript中访问变量模型

  13. 13

    当我使用我之前声明的全局变量时,eslint 显示错误

  14. 14

    当我使用 onClick 箭头函数时,为什么我的变量未定义?

  15. 15

    为什么当我使用 SwingWorker 时我的图像没有下载,而当我不使用时却下载?

  16. 16

    使用变量时不使用索引

  17. 17

    当我使用[=]捕获(使用Lambda类)时,为什么变量变成'const'?

  18. 18

    尝试使用SSH本地时重置连接

  19. 19

    使用python连接SSH时出错

  20. 20

    为什么当我尝试连接反向ssh时将其关闭?

  21. 21

    当我尝试“ ssh localhost”或“ source〜/ .bashrc”时,“无法连接到X服务器”

  22. 22

    当我尝试关闭 ssh2 连接时,没有回复

  23. 23

    当我使用变量进行比较时,JavaScript不足以失败

  24. 24

    当我使用变量作为参数时,为什么fromRaw()返回nil?

  25. 25

    当我尝试使用对象分解导致的变量TS无法识别其类型时

  26. 26

    当我使用var和rgba时,css变量在scss中不起作用

  27. 27

    当我使用2个baseImages时,无法在Dockerfile中传递环境变量

  28. 28

    当我想使用JSONDecoder()解码数据时,某些变量返回nil

  29. 29

    Tkinter-当我尝试打印使用Entry定义的变量时,打印返回“。!entry”

热门标签

归档