1

I tried fish for a while, and then i wanted to set it as my default shell. I edited /etc/passwd and changed the shell of my user to /bin/fish.

The problem is I couldn't login anymore. I tried through my DM (SDDM), it said the login failed at any password I threw at it, correct or wrong. Then I tried it through a tty, got the same results. Replacing fish with the shell I had before in my passwd file seemed to fix this.

Is there any way to set fish as the default shell and still be able to login?

I am running Manjaro Linux.

  • 1
    Your primary mistake was editing /etc/passd by hand. Had you used the appropriate command to change your login shell (e.g., chsh) it would/should have warned you about the problem. – Kurtis Rader Jan 18 at 5:42
2

You need to add this shell to /etc/shells. The manual reads:

/etc/shells is a text file which contains the full pathnames of valid login shells. This file is consulted by chsh(1) and available to be queried by other programs.

Be aware that there are programs which consult this file to find out if a user is a normal user; for example, FTP daemons traditionally disallow access to users with shells not included in this file.

In my Kubuntu this is the content of /etc/shells:

# /etc/shells: valid login shells
/bin/sh
/bin/dash
/bin/bash
/bin/rbash
/usr/bin/tmux
/bin/zsh
/usr/bin/zsh
/usr/bin/fish
/bin/tcsh
/usr/bin/tcsh

As you can see its format is quite self-explanatory. In my case fish is there as /usr/bin/fish. Make sure the right path in your case is /bin/fish and add it to your file.


Note it's better to use chsh to change your login shell, instead of editing /etc/passwd by hand. If you did

chsh -s /bin/fish

you would probably get

chsh: /bin/fish is an invalid shell

Investigating this issue (with man 1 chsh) would probably reveal the existence of /etc/shells to you.

The tool is designed to be run by unprivileged users. If the content of /etc/shells (which is governed by root) is sane, then it's usually impossible for users to lock themselves out. By editing /etc/passwd you may not only lock yourself out like you did; you may (by mistake) break more.

1

I believe Linux requires that all valid login shells be listed in /etc/shells. Add fish to that file before setting it as your login shell. Be sure to use its full correct path.

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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