San*_*oss 6 command-line bash root chsh
我尝试使用chsh命令更改 root 的 shell ,但是现在当我尝试以 root 身份使用sudo -i.
$ sudo -i
sudo: /usr/bin/bash: command not found
Run Code Online (Sandbox Code Playgroud)
我必须修改什么才能获得bash外壳?
hee*_*ayl 12
假设您没有修改路径或创建符号链接,bash二进制文件的默认路径是/bin/bash,而不是/usr/bin/bash。
错误发生,因为你已经设置root的壳为/usr/bin/bash在/etc/passwd这样的:
root:x:0:0:root:/root:/usr/bin/bash
Run Code Online (Sandbox Code Playgroud)
您需要将其更改为/bin/bash:
sudo usermod -s /bin/bash root
Run Code Online (Sandbox Code Playgroud)
或做:
sudo vipw
Run Code Online (Sandbox Code Playgroud)
并手动进行修改。
您显然可以选择您选择的任何其他外壳,只需确保路径正确即可。查找 shell 路径的常见位置是/etc/shells包含系统上所有有效登录 shell 的完整路径的文件。