ssh - mdt shell 未连接或推送 ssh 密钥
问题描述
mdt shell
跟随这里之后,我无法通过 OTG USB-C 端口连接到我的珊瑚开发板。最初,我遇到了这里的问答中概述的孟德尔“拒绝公共设备”问题。我使用串行控制台并nmtui
在我的 LAN 上安装了开发板,并修复了我的主机上的检查代码以匹配我的 LAN 安排(172 而不是 192 块),并且可以通过mdt shell
.
现在,在连接时,我收到以下关于只允许单个 ssh 密钥的错误。screen
自从我最初刷新电路板以来,我只通过串行控制台连接。从来没有人ssh'd。
Waiting for a device...
Connecting to undefined-snail at 172.16.1.39
Key not present on undefined-snail -- pushing
Couldn't connect to keymaster on undefined-snail: [Errno 61] Connection refused.
Did you previously connect from a different machine? If so,
mdt-keymaster will not be running as it only accepts a single key.
You will need to either:
1) Remove the key from /home/mendel/.ssh/authorized_keys on the
device via the serial console
- or -
2) Copy the mdt private key from your home directory on this host
in ~/.config/mdt/keys/mdt.key to the first machine and use
'mdt pushkey mdt.key' to add that key to the device's
authorized_keys file.
Failed to push via keymaster -- will attempt password login as a fallback.
Can't login using default credentials: Bad authentication type; allowed types: ['publickey']
第一个建议指向已知的授权密钥。通过串行控制台,我可以看到该目录不存在 [还没有?]...
mendel@undefined-snail:~$ pwd && ls -la
/home/mendel
total 28
drwxr-xr-x 3 mendel mendel 4096 Aug 13 01:11 .
drwxr-xr-x 4 root root 4096 Feb 14 2019 ..
-rw------- 1 mendel mendel 237 Aug 13 02:01 .bash_history
-rw-r--r-- 1 mendel mendel 220 Feb 14 2019 .bash_logout
-rw-r--r-- 1 mendel mendel 3526 Feb 14 2019 .bashrc
drwx------ 3 mendel mendel 4096 Jul 24 20:51 .gnupg
-rw-r--r-- 1 mendel mendel 807 Feb 14 2019 .profile
关于通过复制本地密钥的第二个建议mdt pushkey
不起作用并重复我在上面收到的相同错误消息mdt shell
macOS Catalina 10.15.6 (19G73)。出厂新板闪过开发板快速启动说明 2020 年 8 月 12 日
解决方案
您可以尝试使用 ssh 而不是 mdt(mdt 只是 ssh 的包装)吗?我相信这是 Catalina 的问题,Linux 和旧版本的 Mac 也可以正常工作,我相信这与他们的 libusb 更改有关。这个问题之前已经报道过,这里是使用 ssh 的快速指南:
在你的 Mac 上创建一个 id_rsa 密钥:
$ ssh-keygen
这会~/.ssh/id_rsa.pub
在您的 MAC 上创建一个文件。您可以将该密钥复制到板上并将内容放入~/.ssh/authorized_keys
(您可以在此文件中放入多个密钥)。之后,您可以继续并通过修改 /etc/ssh/sshd_config 并将 PasswordAuthentication 从 yes 更改为 no 并在开发板上重新启动 ssh 服务来禁用密码身份验证:
$ sudo systemctl restart ssh
然后您可以使用以下命令开始 ssh-ing 到您的开发板:
$ ssh mendel@ip-addr