I installed zsh because I thought I might prefer it over bash. I don't, and to revert it I have used chsh -s /bin/bash, which as myself gives You may not change the shell for 'cat'.

I also changed my line in /etc/passwd from:




(because which bash gave /usr/bin/bash).

GNOME Terminal, xterm, Terminology, etc all now agree my shell is bash.

But, when I enter a virtual terminal by pressing Ctrl Alt N, where n is a numeric key, and try to log in as myself, something like

Ubuntu 15.10 mint-kitty ttyN

mint-kitty login: cat

/bin/zsh: no such file or directory 

appears and then I am logged out.

I can log in to a graphical session just fine. (MDM + Cinnamon.)

As far as I am aware, a user's login shell is determined by /etc/passwd. There are no references to zsh in .bashrc or .profile, nor in /etc/profile.

How do I make the rest of the system aware my shell is not zsh?

  • If you ran sudo chsh, you changed root's shell. Not your own. Changing your own shell should be done with just chsh. – muru Feb 7 '16 at 16:52
  • @muru I got You may not change the shell for 'cat'. – cat Feb 7 '16 at 16:53
  • Very strange. Even stranger is that your passwd line shows /usr/bin/bash as the shell, where one would expect /bin/zsh, given the error you got in TTY. What did you mean by "I changed my line in /etc/passwd"? – muru Feb 7 '16 at 16:58
  • 1
    Do you have an exec /bin/zsh in your bash startup files? – Jeff Schaller Feb 7 '16 at 17:01
  • 3
    You should change the entry in /etc/passwd to /bin/bash. The chsh command only works if called by root or if the current and the new shell are both listed in /etc/shells. That doesn't explain why sshd and login, but not getent, think your login shell is still zsh, rather than /bin/bash. Please post the output of grep passwd /etc/nsswitch.conf and the content of /etc/pam.d/common-auth and /etc/pam.d/login and the output of (as root) grep -r /bin/zsh /etc – Gilles Feb 7 '16 at 20:13

The chsh command only lets you change your login shell from a shell that's listed in /etc/shells, to a shell that's listed in /etc/shells. This is a security and safety feature: if an account has a restricted shell (not listed in /etc/shells), they can't upgrade their access by switching to another shell; and a user can't lock themselves out by switching to a shell that they can't change from. The root user is of course exempt from this restriction.

The check for /etc/shells does not consider alternate ways of naming a file such as symbolic links. If /etc/shells lists /bin/bash, then the entry in the user database must be /bin/bash, not /bin/./bash (which is the same file) or /usr/bin/bash (even if that's a symbolic link to /bin/bash).

If you're moving away from a shell, you need to run chsh to switch back before uninstalling the old shell, because the uninstallation will remove the shell from /etc/shells.

I recommend changing your shell back to /bin/bash; you'll need to do it as root. This way you'll be able to run chsh again in the future.

Under Linux, for a local account, the entry in /etc/passwd is what determines the user's login shell. (This is not true for some other Unix variants, where /etc/passwd is present for compatibility but is not the actual reference, so either /etc/passwd must not be modified or some synchronization command must be invoked after modifying it.)

I can't explain where the reference to /bin/zsh is lingering. Make sure there isn't a stray extra entry in /etc/passwd.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.