我想将我的默认 shell 从 tcsh 更改为 bash。所以我尝试了,这就是发生的事情:
>sudo chsh userid
Changing the login shell for userid
Enter the new value, or press ENTER for the default
Login Shell [/xhbin/tcsh]: /bin/bash
chsh: user 'userid' does not exist in /etc/passwd
Run Code Online (Sandbox Code Playgroud)
确实,我不在 /etc/passwd 中。我不知道为什么。
我能做什么?
今天我尝试切换到另一个shell。
首先我尝试了fish,并用于chsh -s fish
将fish更改为默认值。过了一段时间我发现它不能用~/.bashrc
(&&需要用and代替)。
因为我更喜欢重用~/.bashrc
,我发现zsh
这似乎更容易,并按照此文档切换到zsh
.
当我正在跑步时sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"
,突然它要求我进入Password:
。我输入了 root 密码,但得到了PAM: Authentication failure
.
然后我试图chsh -s bash
和chsh -s zsh
,它总是让我输入密码,抛PAM: Authentication failure
(不系统密码)。我想不通。
关于如何将外壳更改为鱼的任何想法?
$ sudo usermod -s /usr/bin/fish jaan
usermod: user 'jaan' does not exist in /etc/passwd
$ getent passwd $USER
jaan:x:15466:94:Jaan A:/home/jaan:/bin/zsh
Run Code Online (Sandbox Code Playgroud)
相关问题:尝试更改默认shell时,/etc/passwd中不存在用户 似乎它使用了ldap。
$ cat /etc/nsswitch.conf
passwd: compat ldap
group: compat ldap
shadow: compat ldap
# Having the NOTFOUND=return bit was breaking dns resolution on web1 and web2. But we probably
# don't want any of the mdns stuff so let's get rid of it all.
#hosts: files mdns4_minimal [NOTFOUND=return] dns mdns4
hosts: files dns
networks: files
protocols: db …
Run Code Online (Sandbox Code Playgroud) 我尝试使用chsh
命令更改 root 的 shell ,但是现在当我尝试以 root 身份使用sudo -i
.
$ sudo -i
sudo: /usr/bin/bash: command not found
Run Code Online (Sandbox Code Playgroud)
我必须修改什么才能获得bash
外壳?
我正在尝试更改我的用户的默认外壳程序。但我不断收到此错误:
$ chsh
You may not change the shell for 'flimm'.
$ chsh -s "$(which bash)"
You may not change the shell for 'flimm'.
Run Code Online (Sandbox Code Playgroud)
我试图理解为什么我不能为我的用户更改外壳。
我正在尝试将我的默认 shell 更改为 zsh。我将条目正确放置在 /etc/shells 文件中。
我使用此命令所做的每次尝试都以相同的错误消息结束:
chsh -s $(which zsh)
Password: ### after entering the correct password
chsh: PAM: Authentication failure
sudo chsh -s $(which zsh) ## yields the same result
Run Code Online (Sandbox Code Playgroud)
我已将 sudo 用于其他命令,以确保它不是密码失败,并且所有其他命令都有效,但对“chsh”不起作用。
完全被难住了。
附加信息:
我已经按照 Oli 的建议代码在 /etc/shells 文件中附加了一行。
echo $SHELL
/bin/bash
sudo chsh -s /usr/local/bin/zsh
Password:
chsh: PAM: Authentication failure
chsh -s /usr/local/bin/zsh
You may not change the shell for 'username'
Run Code Online (Sandbox Code Playgroud)
还是不能换壳。
人们可以:
sudo chsh -s /bin/sh
或者
sudo chsh -s /bin/sh user_name
据了解,第二个命令更改了指定用户名的 shell,但不清楚在不指定用户名的情况下会发生什么以及反映在哪里?
谢谢你!