Installed ssh and now can't login as root

Having issues with your DietPi installation or found a bug? Post it here.
Post Reply
trigrhappy
Posts: 18
Joined: Sat Aug 31, 2019 6:38 am

Installed ssh and now can't login as root

Post by trigrhappy »

While testing some home automation stuff, I installed ssh to do some troubleshooting for an issue I was having. I solved the issue, but once I restarted, my root login no longer works with putty. I put in my username and password as normal, but I get an "Access Denied" error.

I can login as "dietpi" but not as root. I can even login as dietpi, and SU to root....but I can't login as root directly.

The first time I connected, putty alerted that there was an encryption key mismatch from the previously stored key (most likely because my ssh server replaced dropbear).

How can I uninstall ssh cleanly so that I can go back to dropbear without risking losing ssh entirely?
User avatar
Joulinar
Posts: 3836
Joined: Sat Nov 16, 2019 12:49 am

Re: Installed ssh and now can't login as root

Post by Joulinar »

Hi,

usually switching between Dropbear and OpenSSH should be done using dietpi-software. There is a special option to choose SSH server preference. This will ensure a safe transition between both. I would not recommend to install an SSH server outside dietpi-software.
Pls let us know if a solution is working. This could help others if they hit by similar situation. Your DietPi Team
trigrhappy
Posts: 18
Joined: Sat Aug 31, 2019 6:38 am

Re: Installed ssh and now can't login as root

Post by trigrhappy »

Yes, not installing an ssh external to dietpi is a lesson that I have now learned well.

Dietpi-software was still reflecting dropbear as the default ssh server. I swapped to openssh. It installed, but "reboot" was not found. I did a systemctl reboot. My guess is that a lot of dietpi scripts rely on "reboot".
Last edited by trigrhappy on Sat Dec 19, 2020 1:36 pm, edited 1 time in total.
User avatar
Joulinar
Posts: 3836
Joined: Sat Nov 16, 2019 12:49 am

Re: Installed ssh and now can't login as root

Post by Joulinar »

if you have direct access to your system, remove all SSH server and perform a new installation via dietpi-software > SSH Server preference.

Did you removed Dropbear before installation of your SSH server?
Pls let us know if a solution is working. This could help others if they hit by similar situation. Your DietPi Team
trigrhappy
Posts: 18
Joined: Sat Aug 31, 2019 6:38 am

Re: Installed ssh and now can't login as root

Post by trigrhappy »

I did not remove dropbear. I do have direct access. I changed to openssh, but got the error at the end of it that "reboot" was not found.

I performed systemctl reboot, but my guess is that a LOT of dietpi's scripts will need "reboot" to function properly.
trigrhappy
Posts: 18
Joined: Sat Aug 31, 2019 6:38 am

Re: Installed ssh and now can't login as root

Post by trigrhappy »

It's fixed....... dropbear is the default again, i can login as root, and reboot is working again.

Scary.

Thanks for the help tho! You guys are awesome.
User avatar
Joulinar
Posts: 3836
Joined: Sat Nov 16, 2019 12:49 am

Re: Installed ssh and now can't login as root

Post by Joulinar »

a reboot is performed on software installations only. You would have 2 conflicting SSH server if you installed OpenSSH without removing Dropbear before.
Pls let us know if a solution is working. This could help others if they hit by similar situation. Your DietPi Team
Post Reply