无法更改Google Coral开发板上的sshd_config



所以我在本周早些时候得到了我的开发板。我试着开始使用它,并且能够刷新它,当我执行"mdt设备"时,我的Chromebook能够看到设备。但是当我执行"mdt shell"时,我得到一个错误。我直接尝试了ssh,详细的消息如下所示。我的Chromebook无法看到使用USB-C数据连接的设备,但后来我能够通过usb串行连接连接到它,并使用nmtui将开发板连接到WiFi(与Chromebook连接的网络相同)。从我在Stackoverflow和其他地方读到的问题是与主板上的sshd配置有关,需要禁用PAM或启用密码身份验证。我试图这样做,但后来我看到我(用户mendel)无法编辑/etc/ssh/sshd_config文件,因为mendel不在sudoers中,这很奇怪,因为runonce中有99-mendel-sudo。d,它确实做到了(请参阅https://coral.googlesource.com/mendel-minimal/+/refs/heads/master/etc/runonce.d/99-mendel-sudo,我验证了这个文件存在于我的开发板上)。

那么,有没有人知道这个问题的解决方法(根密码?)。我读过一些人谈论ssh问题,所有的解决方案都涉及编辑sshd_config,这当然是有意义的。唯一的问题是,这些页面(在Medium, Stackoverflow, GitHub上)都没有提到需要先将mendel添加到/etc/sudoers中似乎要么我错过了一些东西,要么是关于添加mendel到sudoers的东西被打破了。

这是我的Linux版本:

mendel@tuned-eft:~$ uname -a
Linux tuned-eft 4.14.98-imx #1 SMP PREEMPT Fri Jul 17 01:15:45 UTC 2020 aarch64 GNU/Linux
mendel@tuned-eft:~$ cat /etc/mendel_version
5.0
mendel@tuned-eft:~$

以下是我Chromebook上的ssh消息:

amiarora@penguin:~$ ssh -v amiarora@tuned-eft c i eth i
OpenSSH_7.9p1 Debian-10+deb10u2, OpenSSL 1.1.1d  10 Sep 2019
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: Applying options for *
debug1: Connecting to tuned-eft [10.55.1.187] port 22.
debug1: Connection established.
debug1: identity file /home/amiarora/.ssh/id_rsa type -1
debug1: identity file /home/amiarora/.ssh/id_rsa-cert type -1
debug1: identity file /home/amiarora/.ssh/id_dsa type -1
debug1: identity file /home/amiarora/.ssh/id_dsa-cert type -1
debug1: identity file /home/amiarora/.ssh/id_ecdsa type -1
debug1: identity file /home/amiarora/.ssh/id_ecdsa-cert type -1
debug1: identity file /home/amiarora/.ssh/id_ed25519 type -1
debug1: identity file /home/amiarora/.ssh/id_ed25519-cert type -1
debug1: identity file /home/amiarora/.ssh/id_xmss type -1
debug1: identity file /home/amiarora/.ssh/id_xmss-cert type -1
debug1: Local version string SSH-2.0-OpenSSH_7.9p1 Debian-10+deb10u2
debug1: Remote protocol version 2.0, remote software version OpenSSH_7.9p1 Debian-10+deb10u2
debug1: match: OpenSSH_7.9p1 Debian-10+deb10u2 pat OpenSSH* compat 0x04000000
debug1: Authenticating to tuned-eft:22 as 'amiarora'
debug1: SSH2_MSG_KEXINIT sent
Connection closed by 10.55.1.187 port 22
amiarora@penguin:~$

dev板上groups命令输出信息。

mendel@tuned-eft:~$ groups
mendel adm sudo audio video plugdev staff games users netdev input render i2c systemd-journal bluetooth apex
mendel@tuned-eft:~$ sudo sudosh
>>> /etc/sudoers: syntax error near line 28 <<<
sudo: parse error in /etc/sudoers near line 28
sudo: no valid sudoers sources found, quitting
sudo: unable to initialize policy plugin
mendel@tuned-eft:~$ 

任何帮助都将非常感激。

对我来说似乎很奇怪的一件事是,您的mendel用户没有sudoer访问权限,但它实际上应该是默认的。没有这个,没有太多的选项来改变sshd_configsudoers文件。我最好的建议是继续使用以下说明重新刷新电路板:https://coral.ai/docs/dev-board/reflash/flash-the-board

代替mdt reboot-bootloader,您可能必须手动重新启动主板并在启动后的前3秒内输入任何内容以进入u-boot模式,并在u-boot提示符中输入以下内容以进入快速引导模式:

fastboot 0

作为参考,这是我的/etc/sudoer看起来像:

#
# This file MUST be edited with the 'visudo' command as root.
#
# Please consider adding local content in /etc/sudoers.d/ instead of
# directly modifying this file.
#
# See the man page for details on how to write a sudoers file.
#
Defaults        env_reset
Defaults        mail_badpass
Defaults        secure_path="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
# Host alias specification
# User alias specification
# Cmnd alias specification
# User privilege specification
root    ALL=(ALL:ALL) ALL
# Allow members of group sudo to execute any command
%sudo   ALL=(ALL:ALL) ALL
# See sudoers(5) for more information on "#include" directives:
#includedir /etc/sudoers.d
mendel ALL=(ALL) NOPASSWD: ALL

我建议仍然使用密钥对身份验证,但使用usb串行连接来设置。

  • 生成密钥对(例如ssh-keygen)
  • 在Chromebook上运行mdt setkey [private key]
  • 将公钥复制到剪贴板
  • 在您的设备上(通过USB串行),编辑~/。Ssh/authorized_keys(您可能会需要生成.ssh和授权密钥)。拷贝你的公钥。
  • MDT现在应该按预期工作了(我喜欢使用MDT setpreferred-device [ip addr]所以我不需要添加ip地址命令)。

关于sudoers的问题,听到mendel没有sudo访问权限,我感到很惊讶。检查我的黑板:

mendel@elusive-dog:~$ groups
mendel adm sudo audio video plugdev staff games users netdev input render i2c systemd-journal bluetooth apex

你能证实吗?

最新更新