Any ideas on how can I change the shell to fish?

$ sudo usermod -s /usr/bin/fish jaan
usermod: user 'jaan' does not exist in /etc/passwd
$ getent passwd $USER
jaan:x:15466:94:Jaan Altosaar:/home/jaan:/bin/zsh

Related questions: user does not exist in /etc/passwd when trying to change the default shell Seems like it uses ldap.

$ cat /etc/nsswitch.conf
passwd:         compat ldap
group:          compat ldap
shadow:         compat ldap

# Having the NOTFOUND=return bit was breaking dns resolution on web1 and web2. But we probably
# don't want any of the mdns stuff so let's get rid of it all.
#hosts:          files mdns4_minimal [NOTFOUND=return] dns mdns4
hosts:          files dns

networks:       files

protocols:      db files
services:       db files
ethers:         db files
rpc:            db files

netgroup:       ldap
automount:      ldap

So I installed ldap relevant package.

$ chsh.ldap
LDAP password for jaan:
Enter the new value, or press ENTER for the default
  Login Shell [/bin/zsh]: /usr/bin/fish
Traceback (most recent call last):
  File "/usr/bin/chsh.ldap", line 69, in <module>
    constants.NSLCD_USERMOD_SHELL: shell,
  File "/usr/share/nslcd-utils/nslcd.py", line 128, in usermod
    assert con.get_response() == constants.NSLCD_RESULT_BEGIN
  File "/usr/share/nslcd-utils/nslcd.py", line 103, in get_response
    return self.read_int32()
  File "/usr/share/nslcd-utils/nslcd.py", line 71, in read_int32
    return _int32.unpack(self.read(_int32.size))[0]
struct.error: unpack requires a string argument of length 4
$ which fish
$ chsh.ldap
LDAP password for jaan:
Enter the new value, or press ENTER for the default
  Login Shell [/bin/zsh]: "/usr/bin/fish"
/usr/bin/chsh.ldap: "/usr/bin/fish" is an invalid shell
$ /usr/bin/fish
(standard_in) 1: syntax error
Welcome to fish, the friendly interactive shell

Here is a hint : /usr/bin/chsh.ldap: "/usr/bin/fish" is an invalid shell. It seems that you should add /usr/bin/fish to /etc/shells.


Hold on, it's an LDAP user, there is a setting in LDAP that allows you to change the default shell for the user in them.

You can install ldap-account-manager which gives you an webfrontent for the ldap configuration.

apt install ldap-account-manager

enter image description here

This can be done on any server which you want to handle the configuration on. Since you will need to configure the server in the config files anyway. But I would recommend you install it on the server which has the ldap actually running, just so you can remember it easier.


To quote ajmitch here,

You can set fish as your default shell by running chsh -s which fish Then log out and back in. (To set it back to bash, you need to use Fish syntax of course, like this chsh -s (which bash))

Just use chsh -s which fish And make sure to log out and log back in or restart you computer.

By the way this could be a possible duplicate here: How do I set fish as the default shell?

  • Hmm..chsh works only if the user in /etc/passwd.$ chsh -s `which fish` Password: chsh: user 'jaan' does not exist in /etc/passwd – Abhishek Bhatia Aug 26 '17 at 23:27
  • Ah... yes... I did not see that part of it... – Max Aug 27 '17 at 0:46
  • 1
    That doesn't work when accounts are managed by LDAP. -1 – David Foerster Aug 29 '17 at 16:59

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.