将默认 shell 从 zsh 更改为 bash

use*_*451 7 bash zsh shell redhat-enterprise-linux

我正在尝试将 RHEL5 中的默认 shell 从 zsh 更改为 bash。我尝试了这个thead 中提到的方法。通过键入sudo /usr/bin/chsh -s /bin/bash,系统会说sudo: /usr/bin/chsh: command not found。但是 /usr/bin/chsh 就在那里。我发现的另一种方法是用我的 usrid 编辑 /etc/passwd 文件,但它禁止我编辑它。有什么建议?

Dan*_*eck 9

/usr/bin/chsh通过运行确保具有执行权限sudo chmod a+x /usr/bin/chsh


您应该可以chsh使用自己的帐户运行。否则,您将设置root's shell。请尝试以下操作:

chsh -s $( which bash )
Run Code Online (Sandbox Code Playgroud)

  • @user268451 您可以指定为哪个帐户设置 shell,例如如下所示:`sudo chsh -s $(which bash) danielbeck`(`danielbeck` 当然是用户名) (3认同)