小米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)有所不同:
  1. 生成公鑰:在你的電腦終端執行 ssh-keygen(如果還沒有公鑰的話)。
  2. 上傳公鑰
    • 你可以使用命令:cat ~/.ssh/id_rsa.pub | ssh root@192.168.31.1 "cat >> /etc/dropbear/authorized_keys"
    • 或者手動 SSH 進入路由器,使用 vi /etc/dropbear/authorized_keys 將公鑰內容貼進去。
  3. 設置權限(確保文件安全):
    bash
    chmod 600 /etc/dropbear/authorized_keys
    chmod 700 /etc/dropbear
    
    請謹慎使用程式碼。

版权声明:
作者:yxbinghe
链接:https://www.zhanhao.ch/?p=636
来源:ice.99
文章版权归作者所有,未经允许请勿转载。

THE END
分享
二维码
< <上一篇
下一篇>>