Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

i want to change default shell env

and run chsh -s /bin/zsh as root user,

but a error message appeared: chsh: PAM authentication failed.

i find this thread

but the answer did not solve my problem

any help would be appreciated

this is the content of /etc/pam.d/chsh

# The PAM configuration file for the Shadow `chsh' service

# This will not allow a user to change their shell unless
# their current one is listed in /etc/shells. This keeps
# accounts with special shells from changing them.
auth       required

# This allows root to change user shell without being
# prompted for a password
auth            sufficient

# The standard Unix authentication modules, used with
# NIS (man nsswitch) as well as normal /etc/passwd and
# /etc/shadow entries.
@include common-auth
@include common-account
@include common-session

this is the content of /etc/shells

# /etc/shells: valid login shells

i find that i used to run chsh -s zsh this will change first line of /etc/passwd as


and chsh will ask for password whaterver you try

i just edit /etc/passwd file manually, and everything is ok.

stupid mistake and thanks for your replies

share|improve this question
Can you provide your /etc/pam.d/chsh ? (BTW it's generally considered a good idea for the root login shell to be minimal / stable - is there areason you want zsh as the default shell rather than starting it after login?) – symcbean Apr 19 '13 at 11:17
i just want to auto-enter zsh shell when i was just logged in, maybe this is not good. – txworking Apr 22 '13 at 5:02
up vote 5 down vote accepted

Check your /etc/shells file and add /bin/zsh to file if this line does not exists.

share|improve this answer
this answer inspired me to check /etc/passwd file whether i input the correct format of shell name. Thx – txworking Apr 22 '13 at 8:10
For me, using a vagrant VM, I needed to change /etc/passwd. Thanks @txworking! – wulftone Nov 4 '14 at 23:19

Looks like your path my be wrong. To check it:

[nick ~]$ which zsh

If the result is /usr/bin/zch, this should do the trick:

[nick ~]$ chsh -s /usr/bin/zsh

*edit for typo.

share|improve this answer

You must run your code as sudo;

sudo chsh -s /bin/zsh

i had same problem too, and it worked!

share|improve this answer

Check your /etc/passwd. In my case I had specified an invalid shell with chsh previously and that's what was causing the problem.

I changed it from zsh as the shell to /bin/zsh and that made the problem go away for me.

share|improve this answer

I faced the same problem. whenever i typed in chsh it use to prompt

chsh: PAM authentication failed

But I solved it by doing some modification in the /etc/passwd file

Users of kali-linux

just open your root terminal and modify /etc/passwd file you can use pico,nano,or vi editor for this job i am going by vi

vi /etc/passwd

then search for the user account. and change the shells to your desired shell make sure the desired shell in installed in your distros of linux for new user to see what shells are present in their linux just type in

cat /etc/shells

it lists them there .If at all you have install the shell and you are unable to see it in /etc/shell you need to create a link and place path of shell say for suppose /bin/ksh in /etc/shells file manually...

for example you are in bash and you want to change it to ksh

just go to account in /etc/passwd file and in the last field edit

/bin/bash to /bin/ksh or /bin/ksh93 (as in your cat /etc/shells)

just logout and login and you are good to go...

for users of other distros (say) ubuntu

type in

sudo -H gnome-terminal (to get a root terminal)

and the process is same as above as you too have root terminal like a kali-linux user..

share|improve this answer

Your Answer


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.