簡體   English   中英

ssh 的“git clone”有時無法在位於 ESXi 的虛擬機上運行

[英]"git clone" by ssh does sometimes not work on a virtual machine located at ESXi

我正在運行在 ESXi 7.0 上運行的虛擬機 (ubuntu 20.04) 我想通過無密碼 ssh 訪問克隆 git repo。 有時 git clone 命令只是沒有響應,但有時一切都順利運行了幾個小時。 緊接着它又尷尬了好幾個小時。

我已經想通了,我可以使用命令ssh -T git@my-git-server.com重現問題 我還嘗試通過增加 ssh 的日志級別來獲取一些有意義的信息: ssh -T -v -v -v git@my-git-server.com

輸出如下(截斷):

...
debug1: Server accepts key: /home/gitlab-runner/.ssh/id_rsa RSA SHA256:klTmu54LL4yj61MM+isEbqfIhSq8wEJXZosw8eGDX9A
debug3: sign_and_send_pubkey: RSA SHA256:klTmu54LL4yj61MM+isEbqfIhSq8wEJXZosw8eGDX9A
debug3: sign_and_send_pubkey: signing using rsa-sha2-512 SHA256:klTmu54LL4yj61MM+isEbqfIhSq8wEJXZosw8eGDX9A
debug3: send packet: type 50
debug3: receive packet: type 52
debug1: Authentication succeeded (publickey).
Authenticated to git-gccp.ds.mhie.com ([10.0.0.7]:22).
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: network
debug3: receive packet: type 80
debug1: client_input_global_request: rtype hostkeys-00@openssh.com want_reply 0
debug3: receive packet: type 4
debug1: Remote: Forced command.
debug3: receive packet: type 4
debug1: Remote: Port forwarding disabled.
debug3: receive packet: type 4
debug1: Remote: X11 forwarding disabled.
debug3: receive packet: type 4
debug1: Remote: Agent forwarding disabled.
debug3: receive packet: type 4
debug1: Remote: PTY allocation disabled.
debug3: receive packet: type 4
debug1: Remote: Forced command.
debug3: receive packet: type 4
debug1: Remote: Port forwarding disabled.
debug3: receive packet: type 4
debug1: Remote: X11 forwarding disabled.
debug3: receive packet: type 4
debug1: Remote: Agent forwarding disabled.
debug3: receive packet: type 4
debug1: Remote: PTY allocation disabled.
debug3: receive packet: type 91
debug2: channel_input_open_confirmation: channel 0: callback start
debug2: fd 3 setting TCP_NODELAY
debug3: ssh_packet_set_tos: set IP_TOS 0x08
debug2: client_session2_setup: id 0
debug1: Sending environment.
debug3: Ignored env SHELL
debug3: Ignored env SUDO_GID
debug3: Ignored env SUDO_COMMAND
debug3: Ignored env SUDO_USER
debug3: Ignored env PWD
debug3: Ignored env LOGNAME
debug3: Ignored env HOME
debug1: Sending env LANG = C.UTF-8
debug2: channel 0: request env confirm 0
debug3: send packet: type 98
debug3: Ignored env LS_COLORS
debug3: Ignored env TERM
debug3: Ignored env USER
debug3: Ignored env SHLVL
debug3: Ignored env PATH
debug3: Ignored env SUDO_UID
debug3: Ignored env MAIL
debug3: Ignored env _
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

但現在我被困住了 - 不知道輸出。 這里出了什么問題? 我了解身份驗證有效,但之后發生了什么?

獲得一些新鮮的想法和想法會很酷。 有沒有人遇到過類似的問題?

我已經在同一個 ESXi 上使用數十台不同的機器(Ubunut、RedHat、CentOS)對此進行了測試,所有機器都具有相同的行為。 從網絡中的裸機機器,我們與 git 服務器有着堅如磐石的連接。 (位於我們的網絡之外)

以防萬一,請仔細檢查是否不涉及防火牆規則

默認情況下, 由於默認防火牆規則,不允許從 ESXi 主機傳出 SSH/SCP。
在從一個 ESXi 主機到另一個 ESXi 主機執行 SSH/SCP 之前,我們需要在該 ESXi 主機的防火牆規則中允許 SSH 客戶端使用:

  • 登錄到 vCenter 並轉到將執行 SSH 的主機
  • 轉到Configure -> System -> Firewall
  • 單擊傳入選項卡本身的“ Edit ”。 啟用“ SSH client
  • 在此之后,如果 SSH 不工作,那么也在目標主機上執行相同的操作。

或者,就像在這里

esxcli network firewall ruleset set --enabled=true --ruleset-id=sshClient

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM