macos无法通过ssh连接到virtualbox中的ubuntu

时间:2017-01-03 15:37:42

标签: ssh virtualbox

寻求帮助。我在我的macbook中安装了一个虚拟机,但无法通过ssh连接到我的虚拟机中的ubuntu。

系统是MacOS Sierra,virtualbox中的ubuntu是ubuntu16.04。我使用端口转发在ubuntu中的mac映射端口22中创建端口2233。

日志在下面。

zhouyajingdeMacBook-Pro:~ yarkeezhou$ ssh -v -p 2233 -i ~/.ssh/id_rsa yarkee@127.0.0.1
OpenSSH_7.3p1, LibreSSL 2.4.1
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 20: Applying options for *
debug1: Connecting to 127.0.0.1 [127.0.0.1] port 2233.
debug1: Connection established.
debug1: identity file /Users/yarkeezhou/.ssh/id_rsa type 1
debug1: key_load_public: No such file or directory
debug1: identity file /Users/yarkeezhou/.ssh/id_rsa-cert type -1
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_7.3
debug1: Remote protocol version 2.0, remote software version OpenSSH_7.2p2 Ubuntu-4ubuntu2.1
debug1: match: OpenSSH_7.2p2 Ubuntu-4ubuntu2.1 pat OpenSSH* compat 0x04000000
debug1: Authenticating to 127.0.0.1:2233 as 'yarkee'
debug1: SSH2_MSG_KEXINIT sent
Connection closed by 127.0.0.1 port 2233

1 个答案:

答案 0 :(得分:1)

我弄清楚了。 Ubuntu错过了ssh密钥。然后通过

修复
ssh-keygen -t rsa -f /etc/ssh/ssh_host_rsa_key
ssh-keygen -t dsa  -f /etc/ssh/ssh_host_dsa_key