备注
AI Translation Notice
This document was automatically translated by hunyuan-turbos-latest model, for reference only.
Source document: kernel/net/ssh.md
Translation time: 2025-11-22 06:51:06
Translation model:
hunyuan-turbos-latest
Please report issues via Community Channel
SSH Support
Currently, we use a lightweight SSH implementation dropbear.
Initialization Steps
Ensure /bin/sh exists (it should already exist, actually busybox; if not, you can copy the busybox file from the sysroot/bin directory:
cp ./bin/sysroot/bin/busybox ./bin/sysroot/bin/sh)Ensure the /root directory exists (it should already exist)
Ensure the /etc/dropbear directory exists
mkdir /etc/dropbear _en```_translated_label__
Ensure the /var/log/lastlog file exists (can be an empty file) (not required)
Change the root user’s password en
_translated_label__shell busybox passwd _entranslated_labelStart the dropbear server after the system boots en
_translated_label__shell dropbear -E -F -R -p 12580 _entranslated_labelConnect to the server from a local terminal en
_translated_label__shell ./dbclient -p 12580 root@localhos _entranslated_label If you encounter an error: _en```_translated_label__shell ./dbclient: Connection to root@localhost:12580 exited:ssh-ed25519 host key mismatch for localhost ! Fingerprint is SHA256:hK2KR5QQnSHpcHLYzCVe9IyKEw1NwIXx41K/gyv7NKI Expected SHA256:W8+kSk+aCm2uoc1ZIKU/RQJSKoqWrOKrFf9URhfFaw8 If you know that the host key is correct you can remove the bad entry from ~/.ssh/known_hosts en```translated_label Solution:
ssh-keygen -R localhostDelete the existing incorrect host keyEnter the root user’s password, and after successful login, you can use the SSH terminal
Exit the SSH terminal _en
_translated_label__shell exit _en
Other Available Commands
Generate SSH key pair
# 生成dropbear的ssh密钥对
dropbearkey -t rsa -f ~/.ssh/id_dropbear
Add the public key to the authorized list
# 拷贝公钥到指定目录
cp ~/.ssh/id_dropbear.pub ./bin/sysroot
# 使用私钥连接到服务器
./dbclient -i ~/.ssh/id_dropbear -p 12580 root@localhost
Reference
Linux TTY/PTS Overview https://liujunming.top/2019/09/03/Linux-TTY-PTS%E6%A6%82%E8%BF%B0/
Pseudo Terminal (pseudo terminal) https://zhuanlan.zhihu.com/p/678170056
Hardware Terminal terminal (TTY) https://www.cnblogs.com/sparkdev/p/11460821.html