Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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 http://ubuntuforums.org/showthread.php?t=1702833

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   pam_shells.so

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

# 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
/bin/sh
/bin/dash
/bin/bash
/bin/rbash
/usr/bin/tmux
/usr/bin/screen
/bin/zsh
/usr/bin/zsh

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

root:x:0:0:root:/root:zsh

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

3 Answers 3

up vote 2 down vote accepted

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

share|improve this answer
1  
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 at 23:19

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

[nick ~]$ which zsh
/usr/bin/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

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.