Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

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
/bin/sh
/bin/bash
/sbin/nologin
/bin/zsh

What could be wrong? How can I fix it?

share|improve this question
    
Did you try running 'chsh' without any arguments as zol? –  uther Jun 2 '12 at 14:48
    
Are you using something like ldap/nis etc.? –  Ulrich Dangel Jun 2 '12 at 14:53

1 Answer 1

up vote 8 down vote accepted

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 

or

$ 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
:wq
share|improve this answer
5  
please use vipw instead of vim as they set the appropriate file locks. –  Ulrich Dangel Jun 2 '12 at 15:06

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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