我在 Windows 机器(Windows 10 企业版操作系统)上使用 Hyper-V 设置了一个(Ubuntu)虚拟机,但似乎我的学校网络安全规则不允许我将互联网共享到虚拟机,所以我想设置一个 ssh 隧道(允许虚拟机访问互联网,以便轻松安装软件包apt install
)。
我在 Windows 机器上安装了 OpenSSH-Win64。但是当我尝试从 ubuntu VM 连接时,它给出了错误:
miranda@ubuntu-vm:~$ ssh -v 'cecs-030929\admin-u5214628'@150.203.213.249
OpenSSH_7.2p2 Ubuntu-4ubuntu2.2, OpenSSL 1.0.2g 1 Mar 2016
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: Applying options for *
debug1: Connecting to 150.203.213.249 [150.203.213.249] port 22.
debug1: Connection established.
debug1: identity file /home/miranda/.ssh/id_rsa type 1
debug1: key_load_public: No such file or directory
debug1: identity file /home/miranda/.ssh/id_rsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/miranda/.ssh/id_dsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/miranda/.ssh/id_dsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/miranda/.ssh/id_ecdsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/miranda/.ssh/id_ecdsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/miranda/.ssh/id_ed25519 type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/miranda/.ssh/id_ed25519-cert type -1
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_7.2p2 Ubuntu-4ubuntu2.2
debug1: Remote protocol version 2.0, remote software version OpenSSH_7.6
debug1: match: OpenSSH_7.6 pat OpenSSH* compat 0x04000000
debug1: Authenticating to 150.203.213.249:22 as 'cecs-030929\\admin-u5214628'
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: algorithm: [email protected]
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
Connection reset by 150.203.213.249 port 22
我不知道该看哪里。从 Ubuntu VM 进行一些检查:
miranda@ubuntu-vm:~$ tcpdchk
miranda@ubuntu-vm:~$ tcpdchk -v
Using network configuration file: (null)
miranda@ubuntu-vm:~$ ifconfig
eth0 Link encap:Ethernet HWaddr 00:15:5d:d5:f9:07
inet addr:150.203.213.248 Bcast:150.203.213.255 Mask:255.255.255.0
inet6 addr: fe80::215:5dff:fed5:f907/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:104320 errors:0 dropped:0 overruns:0 frame:0
TX packets:369 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:16960579 (16.9 MB) TX bytes:65010 (65.0 KB)
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:65536 Metric:1
RX packets:61438 errors:0 dropped:0 overruns:0 frame:0
TX packets:61438 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1
RX bytes:5382563 (5.3 MB) TX bytes:5382563 (5.3 MB)
hosts.allow
我已手动添加了一个包含C:\Windows\System32\drivers\etc
以下内容的文件:
sshd: 150.203.213.248
这并没有什么区别。
答案1
答案2
将最新版本的内容提取到 C:\Program Files\OpenSSH(确保二进制位置仅对 SYSTEM、管理员组具有写入权限。经过身份验证的用户应该且只能拥有读取和执行权限。
就我而言,在为“经过身份验证的用户”分配“读取和执行”权限后,它就可以工作了。