SSH 无法使用 root 密码登录

SSH 无法使用 root 密码登录

我有一个 buildroot 系统,无法通过登录root,使用登录可以.ssh/authorized_keys工作,但由于它是一个只读文件系统,因此不实用。

我如何启用基于密码的登录以及我是否可以启用日志记录sshd以获取更多信息?

  • /etc/ssh/sshd_config

    Subsystem  sftp                   = /usr/libexec/sftp-server
    PermitRootLogin                   = yes
    PasswordAuthentication            = yes
    ChallengeResponseAuthentication   = yes
    
  • /etc/passwd

    root:CD.Dnox5Dc2RQ:0:0:root:/home/root:/bin/sh
    daemon:x:1:1:daemon:/usr/sbin:/bin/false
    bin:x:2:2:bin:/bin:/bin/false
    sys:x:3:3:sys:/dev:/bin/false
    sync:x:4:100:sync:/bin:/bin/sync
    mail:x:8:8:mail:/var/spool/mail:/bin/false
    www-data:x:33:33:www-data:/var/www:/bin/false
    operator:x:37:37:Operator:/var:/bin/false
    test:<hash>/:100:100:user:/home/test:/bin/sh
    nobody:x:99:99:nobody:/home:/bin/false
    sshd:x:1000:1000:SSH drop priv user:/:/bin/false
    
  • ssh -v root@device

    OpenSSH_7.6p1 Ubuntu-4ubuntu0.3, OpenSSL 1.0.2n  7 Dec 2017
    
    debug1: Reading configuration data /etc/ssh/ssh_config
    debug1: /etc/ssh/ssh_config line 19: Applying options for *
    debug1: Connecting to device [192.168.10.202] port 22.
    debug1: Connection established.
    debug1: identity file /home/jenia/.ssh/id_rsa type 0
    debug1: key_load_public: No such file or directory
    debug1: identity file /home/jenia/.ssh/id_rsa-cert type -1
    debug1: key_load_public: No such file or directory
    debug1: identity file /home/jenia/.ssh/id_dsa type -1
    debug1: key_load_public: No such file or directory
    debug1: identity file /home/jenia/.ssh/id_dsa-cert type -1
    debug1: key_load_public: No such file or directory
    debug1: identity file /home/jenia/.ssh/id_ecdsa type -1
    debug1: key_load_public: No such file or directory
    debug1: identity file /home/jenia/.ssh/id_ecdsa-cert type -1
    debug1: key_load_public: No such file or directory
    debug1: identity file /home/jenia/.ssh/id_ed25519 type -1
    debug1: key_load_public: No such file or directory
    debug1: identity file /home/jenia/.ssh/id_ed25519-cert type -1
    debug1: Local version string SSH-2.0-OpenSSH_7.6p1 Ubuntu-4ubuntu0.3
    debug1: Remote protocol version 2.0, remote software version OpenSSH_7.1
    debug1: match: OpenSSH_7.1 pat OpenSSH* compat 0x04000000
    debug1: Authenticating to device:22 as 'root'
    debug1: SSH2_MSG_KEXINIT sent
    debug1: SSH2_MSG_KEXINIT received
    debug1: kex: algorithm: [email protected]
    debug1: kex: host key algorithm: ecdsa-sha2-nistp256
    debug1: kex: server->client cipher: [email protected] MAC: <implicit> compression: none
    debug1: kex: client->server cipher: [email protected] MAC: <implicit> compression: none
    debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
    
    debug1: Server host key: ecdsa-sha2-nistp256 SHA256:VY8wYy/5GDoAl39tVLWHtJcUaDFUfLR1/3hiTBbv+ww
            The authenticity of host 'device (192.168.10.202)' can not be established.
            ECDSA key fingerprint is SHA256:VY8wYy/5GDoAl39tVLWHtJcUaDFUfLR1/3hiTBbv+ww.
            Are you sure you want to continue connecting (yes/no)? yes
            Warning: Permanently added 'device,192.168.10.202' (ECDSA) to the list of known hosts.
    
    debug1: rekey after 134217728 blocks
    debug1: SSH2_MSG_NEWKEYS sent
    debug1: expecting SSH2_MSG_NEWKEYS
    debug1: SSH2_MSG_NEWKEYS received
    debug1: rekey after 134217728 blocks
    debug1: SSH2_MSG_SERVICE_ACCEPT received
    debug1: Authentications that can continue: publickey,password,keyboard-interactive
    debug1: Next authentication method: publickey
    debug1: Offering public key: RSA SHA256:+pbphA33IlRNVBroM+DLokCIZII2eSzo095QDT16gNI /home/jenia/.ssh/id_rsa
    debug1: Authentications that can continue: publickey,password,keyboard-interactive
    debug1: Trying private key: /home/jenia/.ssh/id_dsa
    debug1: Trying private key: /home/jenia/.ssh/id_ecdsa
    debug1: Trying private key: /home/jenia/.ssh/id_ed25519
    debug1: Next authentication method: keyboard-interactive
    debug1: Authentications that can continue: publickey,password,keyboard-interactive
    
    debug1: Next authentication method: password
            root@device password:
    
    debug1: Authentications that can continue: publickey,password,keyboard-interactive
            Permission denied, please try again.
    

相关内容