配置 SSHD
Read time: 2 minute(s)
SSH 协议:安全外壳协议,为 Secure Shell 的缩写。SSH 是建立在应用层和传输层基础上的安全协议。sshd 服务使用 SSH 协议可以用来进行远程控制或在计算机之间传送文件,相比 telnet 方式来传输文件要安全很多,因为 telnet 使用明文传输,sshd 是加密传输。
配置根密码
通过 me 命令进入配置页面,设置 root
登录密码:
System configuration [*] Enable root login with password (aic123) Root password # 设置 root 登录密码为 aic123
配置网络
参考显示部分章节,分别配置以太网和无线网。
配置 openssh
通过 me
命令进入配置页面,勾选下列配置选项:
Third-party packages [*] openssh [*] client [*] server [*] key utilities [*] use sandboxing [ ] use prebuilt binary instead of building from source # 此处不做勾选是为了下一步修改 sshd 配置文件
配置 sshd_config 文件
在 source/third-party/openssh-9.3p1/sshd_config
配置文件中,分别设置如下内容:
...
Port 22 # 设置端口
...
PermitRootLogin yes # 允许 root 用户登录
...
PasswordAuthentication yes # 允许密码认证
...
编译
完成以上配置后,重新编译、烧录固件,运行系统。
验证
- 设置网络。在设备端设置网卡IP,以以太网为例:
ifconfig eth0 up 192.168.10.50
ping 192.168.10.10
PING 192.168.10.10 (192.168.10.10): 56 data byte 64 bytes from 192.168.10.10: seq=0 ttl=128 time=1.178 ms 64 bytes from 192.168.10.10: seq=1 ttl=128 time=0.700 ms 64 bytes from 192.168.10.10: seq=2 ttl=128 time=0.694 ms 64 bytes from 192.168.10.10: seq=3 ttl=128 time=0.607 ms 64 bytes from 192.168.10.10: seq=4 ttl=128 time=0.551 ms 64 bytes from 192.168.10.10: seq=5 ttl=128 time=0.822 ms # 此处验证网络通路正常
- 通过 ssh 登录设备。在 PC 端通过 ssh 工具进行登录,打印信息为:
SSH Connecting to 192.168.10.50 SSH ! Agent auth selected, but no running agent is detected SSH Host key fingerprint: SSH ecdsa-sha2-nistp256 CDYQ22blw5i45bfX6UoWc3mego18Y4KQUj2f3Pzmy28= [aic@~] # [aic@~] # [aic@~] # # 已通过 ssh 登录至设备的 Linux 系统