Error Password: chsh: PAM: Authentication failure when try to install Oh my zsh
I try to install Oh my zsh. After install zsh (sudo apt-get update && sudo apt-get install -y zsh
)
Then I install
sudo apt-get install -y curl
then install git.
the problems occurs when I try this command.
curl -L https://github.com/robbyrussell/oh-my-zsh/raw/master/tools/install.sh | bash
this is the log
sudo curl -L https://github.com/robbyrussell/oh-my-zsh/raw/master/tools/install.sh | bash
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 146 100 146 0 0 91 0 0:00:01 0:00:01 --:--:-- 91
100 1779 100 1779 0 0 525 0 0:00:03 0:00:03 --:--:-- 1416
\033[0;34mCloning Oh My Zsh...\033[0m
Cloning into '/home/icom3/.oh-my-zsh'...
remote: Reusing existing pack: 10101, done.
remote: Total 10101 (delta 0), reused 0 (delta 0)
Receiving objects: 100% (10101/10101), 1.92 MiB | 172.00 KiB/s, done.
Resolving deltas: 100% (5337/5337), done.
Checking connectivity... done.
\033[0;34mLooking for an existing zsh config...\033[0m
\033[0;33mFound ~/.zshrc.\033[0m \033[0;32mBacking up to ~/.zshrc.pre-oh-my-zsh\033[0m
\033[0;34mUsing the Oh My Zsh template file and adding it to ~/.zshrc\033[0m
\033[0;34mCopying your current PATH and adding it to the end of ~/.zshrc for you.\033[0m
\033[0;34mTime to change your default shell to zsh!\033[0m
Password: chsh: PAM: Authentication failure
Is there any idea?
Note, that I have tried
sudo vim /etc/pam.d/chsh
then comment auth required pam_shells.so. However, the error still occur.
Download and run the script separately:
curl -OL https://github.com/robbyrussell/oh-my-zsh/raw/master/tools/install.sh
bash install.sh
And you probably should undo the changes to /etc/pam.d/chsh
.
Explanation:
Piping the text of a script to bash
cat script.sh | bash
is not the same as giving a script as parameter to bash
bash script.sh
By piping install.sh
to bash
, bash takes its standard input (stdin) from the pipe rather than the user. In this case chsh
also seems to be receiving its input from stdin, which is the next line in the script after the call to chsh
. (At the moment it seems to be an empty line. If it were your password, you wouldn't have any problem ;-) )
You can test this with this short script, in which read
expects one line of input:
read -p 'input: ' INPUT
echo -n 'You wrote this: '
echo "> $INPUT <"
saved as script.sh
:
$ bash script.sh
input: foobar
You wrote this: > foobar <
$ cat script.sh | bash
> echo -n 'You wrote this: ' <