嵌入式linux使用dropbear遇到的免密登陆失败问题 至于如何实现免密登陆,只需把登陆方的id_rsa.pub添加到服务器的authorized_keys即可 详细可参考其它内容 此记录下解决问题的过程 1. 用ssh -vvv root@192.168.1.1 查看,有如下记录 debug3: authmethod_is_enabled publickey debug1: Next authentication method: publickey debug1: Offering RSA public key: /home/hjj/.ssh/id_rsa debug3: send_pubkey_testdebug3: send packet: type 50 debug2: we sent a publickey packet, wait for reply debug3: receive packet: type 51 debug1: Authentications that can continue: publickey,password debug1: Trying private key: /home/hjj/.ssh/id_dsa debug3: no such identity: /home/hjj/.ssh/id_dsa: No such file or directory debug1: Trying private key: /home/hjj/.ssh/id_ecdsa debug3: no such identity: /home/hjj/.ssh/id_ecdsa: No such file or directory debug1: Trying private key: /home/hjj/.ssh/id_ed25519 debug3: no such identity: /home/hjj/.ssh/id_ed25519: No such file or directory debug2: we did not send a packet, disable method debug3: authmethod_lookup password debug3: remaining preferred: ,password debug3: authmethod_is_enabled password debug1: Next authentication method: password root@192.168.1.1's password:
2. 查看服务器log 记录 dropbear[28567]: Child connection from 192.168.1.99:55754 dropbear[28567]: /root must be owned by user or root, and not writable by others
3.查看/root 目录 drwx------ 4 dbus dbus 728 Aug 28 2018 root/
原来正如log 所指出的,/root 属主和组是错误的, 修改/root 的用户和组 chown root:root /root
drwx------ 4 root root 728 Aug 28 2018 root/
问题解决,可以免密登陆了, 甚好! 解决此问题也走了不少弯路,故写此纪念. 没想到免密登陆,拷贝等与用户的组和属主有关系,不看log是发现不了的。
