chsh: PAM authentication failed on Ubuntu 12.04 #1224

Closed
sieben opened this Issue Jul 12, 2012 · 33 comments

Comments

Projects
None yet

sieben commented Jul 12, 2012

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

Same issue here...

same here

A login after a logout fixed it.

sieben commented Aug 2, 2012

That's a way to solve the problem but I think that something more neat
should be done.

2012/8/2 tesmar <
reply@reply.github.com

A login after a logout fixed it.


Reply to this email directly or view it on GitHub:
#1224 (comment)

Well, the directions do say to restart ZSH or logout/start new tab. Perhaps it can be answered in the wiki but I don't think it is as big of a deal when someone follows the directions.

Contributor

sanbor commented Sep 25, 2012

Same here, in all my Ubuntu 12.04 machines I have to do chsh -s $(which zsh) to get zsh as default shell.

Contributor

westonplatter commented Oct 18, 2012

1+ for @sanbor's

chsh -s $(which zsh)

Same issue here

Add zsh location to /etc/shells

http://ubuntuforums.org/showthread.php?t=1702833

To be sure, logout and then login back

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

da-n commented Jun 12, 2013

@sanbor solution works for me as well, had the issue on Ubuntu Server 13.04 x64.

Mixing with @sanbor suggestion, we could take:

touch /etc/shells && command -v zsh >> /etc/shells && chsh -stail -n1 /etc/shells``

Or, if running with sudo

test "$SUDO_USER" && command -v zsh >> /etc/shells && chsh -stail -n1 /etc/shells $SUDO_USER``

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.

arukaen commented Aug 19, 2013

for some reason I cant get oh my zsh to work on my user. I ran it on root and it worked fine and I ran it on all my other servers/workstations and they worked alright but so far its been impossible to run it on my work computer using my user.

cris@desktop:~$ source ~/.zshrc
bash: /home/cris/.oh-my-zsh/oh-my-zsh.sh: line 14: syntax error near unexpected token (' bash: /home/cris/.oh-my-zsh/oh-my-zsh.sh: line 14:for config_file ($ZSH/lib/*.zsh); do'

EDIT
Well I restarted my entire computer out of frustration and it worked now. I guess closing the terminal and opening it again doesnt always work.

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?

satgi commented Mar 21, 2014

@ryaninhust
Thanks, it works!

VeryCB commented Apr 24, 2014

@ryaninhust works for me...haha

orendon commented May 11, 2014

FYI, had the same issue on ubuntu 14.04 using crouton on my chromebook
chsh -s $(which zsh) + logout and login works!

I just fixed it by removing that line from the install shell file

  curl -L http://install.ohmyz.sh | sed -n '/chsh/!p' | sh
  # and do this instead
  sudo chsh -s $(which zsh) your_user

I also had to remove the zsh invokation at the end, I guess what I want, and lots of others want to, is a curl install that can work unattended (without any prompts), for the moment here's a hacky way to do it, by stripping the lines that make the script stop (waiting for user input):

  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
  # execute install from file
  sh /tmp/oh-my-zsh-install.sh
  rm /tmp/oh-my-zsh-install.sh 
  # chsh without a prompt
  sudo chsh -s $(which zsh) your_user_name

Thanks @orendon logout and login again worked for me. 😄

ldong commented Jan 25, 2015

Try this

echo $(which zsh) | sudo tee -a /etc/shells
chsh $USER -s $(which zsh);

eeree commented Feb 9, 2015

@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`
Contributor

apjanke commented Feb 28, 2015

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
Contributor

apjanke commented Feb 28, 2015

Possibly better workaround: sh -c and subshell output capturing.

sh -c "$(curl -fsSL https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"

Anyone want to give this a try and see if it fixes the Authentication Errors you were getting?

brnrc commented Mar 2, 2015

@apjanke worked for me.

Linux mate 3.13.0-37-generic #64-Ubuntu SMP Mon Sep 22 21:28:38 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux
Contributor

zhiyelee commented Mar 31, 2015

chsh -s $(which zsh) works well for me

@apjanke perfect solution

@apjanke Thanks man! That was a flawless solution!
All others were indeed missdiagnoses

@bhilburn bhilburn referenced this issue in bhilburn/powerlevel9k Jun 27, 2015

Merged

Prezto & antigen support #38

RobertTheNerd added a commit to RobertTheNerd/oh-my-zsh that referenced this issue Aug 29, 2016

@ryaninhust you are a god

ryaninhust's solution worked,tried on latest Ubuntu 16 terminal

@ryaninhust solution's works well on Raspbian 8.0 aswell

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment