ohmyzsh: chsh: PAM authentication failed on Ubuntu 12.04

I’m using Ubuntu through travis-ci to test my dotfiles. I got the same error on my 12.04 when I installed oh my zsh after have followed the same steps.

After installing zsh (sudo apt-get install zsh) and change my shell successfully (sudo chsh --shell $(which zsh)), I still get an error from oh my zsh install.sh :

Password: chsh: PAM authentication failed
385         __                                     __  
386  ____  / /_     ____ ___  __  __   ____  _____/ /_  
387 / __ \/ __ \   / __ `__ \/ / / /  /_  / / **_/ __ \ 
388/ /_/ / / / /  / / / / / / /_/ /    / /_(**  ) / / / 
389_**_/_/ /_/  /_/ /_/ /_/\**, /    /**_/_**_/_/ /_/  
390                        /____/  
391
392
393 ....is now installed.
394sh: source: not found
395make: **\* [zsh] Error 127

The complete error stack is available at : http://travis-ci.org/#!/sieben/dotfiles

About this issue

  • Original URL
  • State: closed
  • Created 12 years ago
  • Comments: 35 (5 by maintainers)

Commits related to this issue

Most upvoted comments

well, my solution maybe help you

sudo vim /etc/pam.d/chsh

then, comment auth required pam_shells.so

sudo chsh $USER -s $(which zsh)

done, logout and login does it work?

To solve this actually you have to chsh as your user. When you sudo it’ll change the shell of the root account.

Instead:

chsh $USER -s $(which zsh);

Then logout and log back in. or source your zshrc file: source ~/.zshrc

I have a EC2 whit fish shell. Is the same problem.

sudo chsh $USER -s $(which fish);

Then I logout and login.

If the hostname is not the default or get the message “sudo: unable to resolver host”, fix the hosts file in your server.

Hi folks. I think most of these are misdiagnoses. The main problem is that on Linux, chsh prompts for password when you’re not root, and when installing with the form curl ... | sh, the shell’s stdin is hooked up to the pipe containing install.sh, so when chsh prompts for a password, it’s reading from the install script instead of the terminal and your keyboard. (This AskUbuntu answer nails it.) So that chsh command will work when you type it interactively, but not from within the installer script when invoked the way we do now.

A workaround is to use a temp file instead of a pipe for the install script. This will leave stdin attached to the tty for chsh to read from, and will work without changes to the script itself.

curl -L http://install.ohmyz.sh > install.sh && sh install.sh

1+ for @sanbor’s

chsh -s $(which zsh)

@benjamine We can also use whoami to automatically add username to the end of a script:

curl -L http://install.ohmyz.sh | sed -n '/chsh/!p' | sed -n '/env zsh/!p' | sed -n '/^\. ~\/\.zshrc/!p' > /tmp/oh-my-zsh-install.sh
sh /tmp/oh-my-zsh-install.sh
rm /tmp/oh-my-zsh-install.sh
sudo chsh -s $(which zsh) `whoami`

@ryaninhust works for me…haha