小米r2d免密登陆
🌐─(root㉿wise)-[~]
└─# grep -A 10 "r2d" /root/.ssh/config
Host r2d
HostName 10.11.69.228
User root
IdentityFile /root/.ssh/id_rsa_old
KexAlgorithms +diffie-hellman-group1-sha1
HostKeyAlgorithms +ssh-rsa
PubkeyAcceptedAlgorithms +ssh-rsa
配置步驟
由於小米路由器使用的是 Dropbear(一個輕量級的 SSH 伺服器),而非標準的 OpenSSH,因此配置路徑與常見的 Linux 系統(通常在
~/.ssh/authorized_keys)有所不同:- 生成公鑰:在你的電腦終端執行
ssh-keygen(如果還沒有公鑰的話)。 - 上傳公鑰:
- 你可以使用命令:
cat ~/.ssh/id_rsa.pub | ssh root@192.168.31.1 "cat >> /etc/dropbear/authorized_keys"。 - 或者手動 SSH 進入路由器,使用
vi /etc/dropbear/authorized_keys將公鑰內容貼進去。
- 你可以使用命令:
- 設置權限(確保文件安全):
bash
chmod 600 /etc/dropbear/authorized_keys chmod 700 /etc/dropbear請謹慎使用程式碼。
yxbinghe
root密码 1537c831(000000@)