尝试安装时出现错误密码:chsh:PAM:身份验证失败 Oh my zsh

尝试安装时出现错误密码:chsh:PAM:身份验证失败 Oh my zsh

我尝试安装 Oh my zsh。安装 zsh 后 ( sudo apt-get update && sudo apt-get install -y zsh)

然后我安装

sudo apt-get install -y curl  

然后安装 git。

当我尝试此命令时出现问题。

curl -L https://github.com/robbyrussell/oh-my-zsh/raw/master/tools/install.sh | bash

这是日志

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

有什么想法吗?

请注意,我已经尝试过

sudo vim /etc/pam.d/chsh  

然后注释掉 auth required pam_shells.so。但是错误仍然出现。

答案1

单独下载并运行脚本:

curl -OL https://github.com/robbyrussell/oh-my-zsh/raw/master/tools/install.sh
bash install.sh

您可能应该撤消对 的更改/etc/pam.d/chsh

解释:

将脚本文本传输至bash

cat script.sh | bash

与将脚本作为参数传递给bash

bash script.sh

通过管道传输install.shbash,bash 将其标准输入 (标准输入)来自管道,而不是用户。在这种情况下,chsh它似乎也从标准输入,这是脚本中调用 之后的下一行chsh。(目前它似乎是一个空行。如果它是您的密码,您不会遇到任何问题 ;-) )

您可以使用这个简短的脚本来测试这一点,其中read需要一行输入:

read -p 'input: ' INPUT
echo -n 'You wrote this: '
echo "> $INPUT <"

保存为script.sh

$ bash script.sh
input: foobar
You wrote this: > foobar <
$ cat script.sh | bash
> echo -n 'You wrote this: ' <

相关内容