I want to change my shell from bash to zsh.

I have tried running the following while logged in as user zol:

$ chsh -s /bin/zsh
$ sudo chsh -s /bin/zsh zol
$ su -c 'chsh -s /bin/zsh zol'
# The above all results with:
$ password:
$ chsh: Shell not changed.

# zsh exists in /etc/shells.. 
chsh -l

What could be wrong? How can I fix it?

  • Did you try running 'chsh' without any arguments as zol? – George M Jun 2 '12 at 14:48
  • Are you using something like ldap/nis etc.? – Ulrich Dangel Jun 2 '12 at 14:53
  • Much more importantly: Why doesnt it give you more info? That message might be fine for a seasoned sysop but for most people it's downright rude. Im facing the same problem 5 years on, and people wonder why linux has spent the past 20 years not on the desktop. – flurbius Sep 4 '17 at 12:26
  • You expected your shell to change instantly? You change your login shell with chsh, which means you will have to log in again. – Kusalananda Nov 6 '19 at 17:02

User account modifications will not be saved if you have opened /etc/passwd (vim /etc/passwd) when you try to change the info.

Alternative: try with usermod (as zol):

$ usermod -s /bin/zsh 


$ sudo usermod -s /bin/zsh zol

If this doesn't work either, edit /etc/passwd by hand.

sudo vipw
# set zol's shell to /bin/zsh
  • 7
    please use vipw instead of vim as they set the appropriate file locks. – Ulrich Dangel Jun 2 '12 at 15:06
  • "User account modifications will not be saved if you have opened /etc/passwd" — but why? – Thanatos Feb 3 '15 at 19:44
  • It doesn't work too. When I restart Linux virtual machine (centos7), it's OK now! – WeizhongTu Jul 11 '16 at 10:56
  • @fromnaboo Can you please explain why you make this claim in your first sentence, as @ Thanatos already asked ? You have not provided any explanation about this, and this seems to spawn out of nowhere, as is. – Atralb Dec 2 '20 at 10:07

Just ran into this. No matter what I did logging in and back out would not change my shell yet it was listed in /etc/shells and in /etc/passwd.

finally it dawned on me: Maybe I am logged in with another session?

So I did

# who

and it validated I did have indeed other open sessions from other machines:

dom  pts/0        Nov 6 13:53 (
dom  pts/1        Nov 5 12:30 (
dom  pts/2        Nov 4 12:33 (

I then did:

pkill -KILL -u dom

I was immediately logged out and after logging back in: Voila! Shell was changed


When to run "chsh -l" if you to see:


Then use:

chsh -s /usr/bin/zsh

Warning: The commands was run on Fedora 25, In ubuntun the option "-l" from is out.

  • -l is an invalid option for me. I'm on Ubuntu 16.04 – byxor Jul 27 '17 at 10:39
  • Sorry, I don't give information about the distro where the commands work. In my case I tested on Fedora 25. I try on ubuntu and I verify the option "-l" is out. – joaolsouzajr Jul 27 '17 at 13:18
  • Regardless, chsh -s worked perfectly. Thanks. – byxor Jul 27 '17 at 13:33
  • The option is valid on Manjaro but it still refuses to change the shell. – flurbius Sep 4 '17 at 12:28

If you see chsh: Shell not changed., it could mean that the shell was already changed.

Check which shell is listed:

cat /etc/passwd | grep `cd; pwd`

If it's correct, log out and back in to have the change take effect.


Change it from /etc/passwd

I had some problems with zsh (that is default in manjaro) and I used it for get back to bash.

[infinito@manjaro ~]$ grep infinito /etc/passwd
infinito:x:1000:1000:Sergio N:/home/infinito:/bin/bash      <---here
  • 1
    please don't post text as image, you might want to use grep infinito /etc/passwd – Archemar Apr 20 at 7:26

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.