rah*_*hmu 23
如果您无权访问用户并且具有 root 权限,那么 Chris Browne 的答案会很有效。
如果要更改当前用户的默认 shell,还可以使用:
chsh -s /bin/ksh
Run Code Online (Sandbox Code Playgroud)
更多信息
用户的登录 shell 在文件中定义(/etc/passwd
在 Debian 上)。此文件为每个用户都有一个条目,其中包含在创建时输入的信息。
rahmu:x:1000:1000:My Nameisrahmu,,,:/home/rahmu:/bin/bash
anotheruser:x:1001:1001:,,,:/home/anotheruser:/bin/ksh
Run Code Online (Sandbox Code Playgroud)
最后一列是登录外壳。如果成功,它将被登录程序分叉。
但是,强烈建议您不要手动修改此文件。您应该尽可能使用chsh
或usermod
。
您可以使用该chsh
命令更改您的登录 shell 。作为man chsh
注释,普通用户只能更改自己账户的外壳,而root可以改变所有帐户的外壳。
/etc/shells
包含有效登录 shell 的路径名。该文件chsh
在被调用时被查询。
使用说明chsh
因您的 UNIX 风格而异:
Linux:
chsh -s newshell
Run Code Online (Sandbox Code Playgroud)
索拉里斯:
chsh newshell
Run Code Online (Sandbox Code Playgroud)
用户体验
chsh username newshell
Run Code Online (Sandbox Code Playgroud)
艾克斯
chsh
Run Code Online (Sandbox Code Playgroud)
这将启动一个交互式会话,提示您输入新 shell 的完整路径。
参考:http : //kb.iu.edu/data/benf.html