备注

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

  1. 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)

  2. Ensure the /root directory exists (it should already exist)

  3. Ensure the /etc/dropbear directory exists

    mkdir /etc/dropbear
    _en```_translated_label__
    
  4. Ensure the /var/log/lastlog file exists (can be an empty file) (not required)

  5. Change the root user’s password en_translated_label__shell  busybox passwd  _entranslated_label

  6. Start the dropbear server after the system boots en_translated_label__shell  dropbear -E -F -R -p 12580  _entranslated_label

  7. Connect 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 localhost Delete the existing incorrect host key

  8. Enter the root user’s password, and after successful login, you can use the SSH terminal

  9. 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