Cannot login as root via ssh even after changing the password

G_DIETPI_VERSION_CORE=6
G_DIETPI_VERSION_SUB=31
G_DIETPI_VERSION_RC=2
G_GITBRANCH='master'
G_GITOWNER='MichaIng'
Linux DietPi 5.4.51-v7l+ #1333 SMP Mon Aug 10 16:51:40 BST 2020 armv7l GNU/Linux
RPi 4 Model B (armv7l)

So I suddenly can’t login via ssh as root user.

root@DietPi:~# sudo passwd root
New password: 
Retype new password: 
passwd: password updated successfully

After changing password to the same I had.

trying to login from win10

OpenSSH_for_Windows_7.7p1, LibreSSL 2.6.5
debug1: Connecting to rpi4 [192.168.1.106] port 22.
debug1: Connection established.
debug1: key_load_public: No such file or directory
debug1: identity file C:\\Users\\Nightliss/.ssh/id_rsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file C:\\Users\\Nightliss/.ssh/id_rsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file C:\\Users\\Nightliss/.ssh/id_dsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file C:\\Users\\Nightliss/.ssh/id_dsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file C:\\Users\\Nightliss/.ssh/id_ecdsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file C:\\Users\\Nightliss/.ssh/id_ecdsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file C:\\Users\\Nightliss/.ssh/id_ed25519 type -1
debug1: key_load_public: No such file or directory
debug1: identity file C:\\Users\\Nightliss/.ssh/id_ed25519-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file C:\\Users\\Nightliss/.ssh/id_xmss type -1
debug1: key_load_public: No such file or directory
debug1: identity file C:\\Users\\Nightliss/.ssh/id_xmss-cert type -1
debug1: Local version string SSH-2.0-OpenSSH_for_Windows_7.7
debug1: Remote protocol version 2.0, remote software version dropbear_2018.76
debug1: no match: dropbear_2018.76
debug1: Authenticating to rpi4:22 as 'root'
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: algorithm: curve25519-sha256
debug1: kex: host key algorithm: ecdsa-sha2-nistp256
debug1: kex: server->client cipher: aes128-ctr MAC: hmac-sha2-256 compression: none
debug1: kex: client->server cipher: aes128-ctr MAC: hmac-sha2-256 compression: none
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug1: Server host key: ecdsa-sha2-nistp256 SHA256:Qx15d2/4fSaJzf7ovzhqzMbtikIlIaT6LvBrkdZ4j1M
debug1: Host 'rpi4' is known and matches the ECDSA host key.
debug1: Found key in C:\\Users\\Nightliss/.ssh/known_hosts:1
debug1: rekey after 4294967296 blocks
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: rekey after 4294967296 blocks
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey,password
debug1: Next authentication method: publickey
debug1: Trying private key: C:\\Users\\Nightliss/.ssh/id_rsa
debug1: Trying private key: C:\\Users\\Nightliss/.ssh/id_dsa
debug1: Trying private key: C:\\Users\\Nightliss/.ssh/id_ecdsa
debug1: Trying private key: C:\\Users\\Nightliss/.ssh/id_ed25519
debug1: Trying private key: C:\\Users\\Nightliss/.ssh/id_xmss
debug1: Next authentication method: password
debug1: read_passphrase: can't open /dev/tty: No such file or directory
root@rpi4's password:
debug1: Authentications that can continue: publickey,password
Permission denied, please try again.
debug1: read_passphrase: can't open /dev/tty: No such file or directory
root@rpi4's password:
debug1: Authentications that can continue: publickey,password
Permission denied, please try again.
debug1: read_passphrase: can't open /dev/tty: No such file or directory

Rpi has static lease from router and set static ip. I’m also using vnc viewer and I can login just fine. Any help is appreciated :slight_smile:

Can you login with user dietpi?

Yes, I can. I mean I can work with that but I always was logging in as root. No clue why it stopped working.

I would recommend to reset root pw again

dietpi-config > 6 - Security Options > 1 - Change Passwords

As well you can try to login via SSH as user dietpi and simply run su to switch to root.

Changing password did not help :confused:

Yes, I’m aware I can just su as any user who has access to it. What a dumb issue.

but su is working and you are able to switch from user dietpi to user root?

Ok I found what was wrong. Kinda dumb of me. Around week ago I installed zsh shell and set it as default for root. Then I uninstalled it few hours later and did not switch the shell back :roll_eyes:

Had to:

sudo chsh -s /bin/bash root

Joulinar
Well I could not :smiley:. Thanks for pointing me in the right direction. Am by no means good at linux stuff :slight_smile:

su: failed to execute /bin/zsh: No such file or directory

ok good that it is fixed now :smiley: