如何從 Linux 主機透過 ssh 連線到 Virtual Box Windows 7 用戶端?

如何從 Linux 主機透過 ssh 連線到 Virtual Box Windows 7 用戶端?

我已經在來賓上安裝了 Cygwin 並設定了 sshd。我可以ssh localhost從客人內部。

虛擬機器與“NAT”適配器連接,我為虛擬機器設定了一個連接埠轉送規則,如下所示:

TCP 127.0.0.1 6666 10.0.2.15 22

但是當我嘗試從 Linux 主機連接時:

$ ssh  -v -p 6666 [email protected]
OpenSSH_6.6.1, OpenSSL 1.0.1f 6 Jan 2014
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: Applying options for *
debug1: Connecting to 127.0.0.1 [127.0.0.1] port 6666.
debug1: Connection established.
debug1: identity file /home/pjmp/.ssh/id_rsa type 1
debug1: identity file /home/pjmp/.ssh/id_rsa-cert type -1
debug1: identity file /home/pjmp/.ssh/id_dsa type -1
debug1: identity file /home/pjmp/.ssh/id_dsa-cert type -1
debug1: identity file /home/pjmp/.ssh/id_ecdsa type -1
debug1: identity file /home/pjmp/.ssh/id_ecdsa-cert type -1
debug1: identity file /home/pjmp/.ssh/id_ed25519 type -1
debug1: identity file /home/pjmp/.ssh/id_ed25519-cert type -1
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_6.6.1p1 Ubuntu-2ubuntu2.8

該命令因此輸出而掛起。我究竟做錯了什麼?

答案1

除了虛擬機器中非常簡單的網路連線之外,NAT 介面對於任何其他事情都毫無用處。橋接介面並在 LAN 上取得可尋址 IP、使用專用介面或 NAT + 其他之一的組合。

答案2

我發現反之亦然,所以從 cygwin ssh 到 linux 主機也能正常運作。所以我使用它是因為從哪一側建立連接對我來說並不重要。

相關內容