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
    Commented Jun 2, 2012 at 14:48
  • Are you using something like ldap/nis etc.? Commented Jun 2, 2012 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
    Commented Sep 4, 2017 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
    Commented Nov 6, 2019 at 17:02
  • I was working with VSCode and seems it keeps a separate default shell (independent of the system shell)...
    – gebbissimo
    Commented Feb 17, 2023 at 21:07

6 Answers 6


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
  • 9
    please use vipw instead of vim as they set the appropriate file locks. Commented Jun 2, 2012 at 15:06
  • "User account modifications will not be saved if you have opened /etc/passwd" — but why?
    – Thanatos
    Commented Feb 3, 2015 at 19:44
  • It doesn't work too. When I restart Linux virtual machine (centos7), it's OK now!
    – WeizhongTu
    Commented Jul 11, 2016 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
    Commented Dec 2, 2020 at 10:07
  • @Atralb because vi/vim overwrites the original with your new version when you save the file. That's partly why you should always use vipw instead of vi[m], because it locks the file against other changes as well as checking the syntax of the file before updating it Commented Jun 20 at 13:08

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

  • It works, why "logged in with another session" create a problem?
    – Broly LSSJ
    Commented Sep 8, 2022 at 12:39

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.

  • Thanks! This was my rookie mistake. I had to log out and log in again for the change to take place.
    – zslim
    Commented Nov 21, 2022 at 21:02

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
    Commented Jul 27, 2017 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. Commented Jul 27, 2017 at 13:18
  • Regardless, chsh -s worked perfectly. Thanks.
    – byxor
    Commented Jul 27, 2017 at 13:33
  • The option is valid on Manjaro but it still refuses to change the shell.
    – flurbius
    Commented Sep 4, 2017 at 12:28

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
    Commented Apr 20, 2021 at 7:26

Circling back on this if anyone wants a simple solution:

I was logged in as root and I got the same error message as was listed before using chsh. This is what worked for me.

If I wanted to toggle to the Bourne Shell:


If I wanted to toggle to Bash:

New contributor
Charles Owen is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.
  • 1
    The question was about changing the (login) shell, not running a shell. Commented Jun 20 at 5:04

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .