我以前没有使用过 SSH,所以我可能做错了什么。我正尝试通过 SSH 连接到虚拟机。在我运行的虚拟机上,ip a | grep inet
它提供了以下输出:
inet 127.0.0.1/8 scope host lo
inet6 ::1/128 scope host
inet 10.0.2.15/24 brd 10.0.2.255 scope global dynamic noprefixroute enp1s0
inet6 fec0::71ba:9fda:943b:113a/64 scope site dynamic noprefixroute
inet6 fe80::afca:876f:1e52:40fb/64 scope link noprefixroute
我在另一台机器上运行它ssh -v 10.0.2.15
并给出以下输出:
OpenSSH_8.9p1 Ubuntu-3ubuntu0.1, OpenSSL 3.0.2 15 Mar 2022
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: include /etc/ssh/ssh_config.d/*.conf matched no files
debug1: /etc/ssh/ssh_config line 21: Applying options for *
debug1: Connecting to 10.0.2.15 [10.0.2.15] port 22.
这就是它所做的一切。如果我运行 ssh 时没有使用详细标志,它不会打印任何内容。终端被锁定,我必须使用 ctrl+c 终止该进程。我做错了什么,如何使用 ssh 连接到此虚拟机?
运行命令 ping -c4 10.0.2.15 得到以下输出:
PING 10.0.2.15 (10.0.2.15) 56(84) bytes of data.
^C
--- 10.0.2.15 ping statistics ---
4 packets transmitted, 0 received, 100% packet loss, time 3076ms
该命令ssh -vvvv 10.0.2.15
给出以下输出:
OpenSSH_8.9p1 Ubuntu-3ubuntu0.1, OpenSSL 3.0.2 15 Mar 2022
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: include /etc/ssh/ssh_config.d/*.conf matched no files
debug1: /etc/ssh/ssh_config line 21: Applying options for *
debug2: resolve_canonicalize: hostname 10.0.2.15 is address
debug3: expanded UserKnownHostsFile '~/.ssh/known_hosts' -> '$HOME/.ssh/known_hosts'
debug3: expanded UserKnownHostsFile '~/.ssh/known_hosts2' -> '$HOME/.ssh/known_hosts2'
debug3: ssh_connect_direct: entering
debug1: Connecting to 10.0.2.15 [10.0.2.15] port 22.
debug3: set_sock_tos: set socket 3 IP_TOS 0x10