Unable to login as root or as user because zsh is missing

6,505

I guess that the default shell for root user is /usr/bin/zsh This is configured in /etc/passwd Do you have another account on that system with another default shell? If so, if you have configured sudo perhaps it's possible to edit the /etc/passwd file with sudo and change the default shell to /bin/sh or /bin/bash.

Otherwise you have to mount the filesystem/disk from a bootable usb-stick or do a network boot, or mount it from another device and fix it that way.

Share:
6,505

Related videos on Youtube

max_
Author by

max_

Updated on September 18, 2022

Comments

  • max_
    max_ over 1 year

    I installed zsh on my raspberry pi and for various reasons including the fact that the shell completely slowed down, I decided to remove it. I uninstall the package, changed the shell back to /bin/bash and assumed all would be ok. However, It looks like there was an issue uninstalling it.

    When I tried to log back into the pi, via SSH, I was shown the following:

    Welcome to KRATOS
    Permission denied (publickey).
    

    I know that the public key was fine as it's worked in the past, so I hooked the pi up to a monitor to see the log as it awoke. It ran everything as expected, and then when I attempted to login with the username and password of pi, it logged me in, then presented the error and proceeded to log me out.

    Cannot execute /usr/bin/zsh: No such file or directory
    

    The same happens when I try to login as root.

    Have I completely locked myself out of the system, or is there a way of getting back in? Worst comes to worst, I can try and mount the filesystem onto another laptop and change the configuration from there?

    • GregHNZ
      GregHNZ about 8 years
      Can you try specifying bash as the shell with the ssh command ? ssh -t root@host bash
  • max_
    max_ about 8 years
    Fantastic, I did have another user on the system - by chance!
  • Scott - Слава Україні
    Scott - Слава Україні over 5 years
    What does sudo apt-get update && sudo apt-get upgrade have to do with this question?  How is the user supposed to issue this command line when he can't get to a shell prompt? How does your answer "give [the user] temporary permissions as root"?