概述
本文翻译自:Changing default shell in Linux [closed]
How is it possible to change the default shell? 如何更改默认外壳? The env
command currently says: env
命令当前显示:
SHELL=/bin/tcsh
and I want to change that to Bash. 我想将其更改为Bash。
#1楼
参考:https://stackoom.com/question/sjuS/在Linux中更改默认Shell
#2楼
You should have a 'skeleton' somewhere in /etc
, probably /etc/skeleton
, or check the default settings, probably /etc/default
or something. 您应该在/etc
某个位置(可能是/etc/skeleton
有一个“骨架”,或者检查默认设置,可能是/etc/default
或其他内容。 Those are scripts that define standard environment variables getting set during a login. 这些是定义登录时设置的标准环境变量的脚本。
If it is just for your own account: check the (hidden) file ~/.profile
and ~/.login
. 如果仅用于您自己的帐户:检查(隐藏)文件~/.profile
和~/.login
。 Or generate them, if they don't exist. 或生成它们(如果它们不存在)。 These are also evaluated by the login process. 这些也将通过登录过程进行评估。
#3楼
Try linux command chsh
. 尝试linux命令chsh
。
The detailed command is chsh -s /bin/bash
. 详细的命令是chsh -s /bin/bash
。 It will prompt you to enter your password. 它将提示您输入密码。 Your default login shell is /bin/bash
now. 您的默认登录Shell现在是/bin/bash
。 You must log out and log back in to see this change. 您必须注销并重新登录才能看到此更改。
The following is quoted from man page: 手册页中引用了以下内容:
The chsh command changes the user login shell. chsh命令更改用户登录外壳。 This determines the name of the users initial login command. 这确定了用户初始登录命令的名称。 A normal user may only change the login shell for her own account, the superuser may change the login shell for any account 普通用户只能为自己的帐户更改登录外壳,超级用户可以为任何帐户更改登录外壳
This command will change the default login shell permanently. 此命令将永久更改默认登录外壳。
Note: If your user account is remote such as on Kerberos authentication (eg Enterprise RHEL) then you will not be able to use chsh
. 注意:如果您的用户帐户是远程的,例如在Kerberos身份验证(例如Enterprise RHEL)上,则您将无法使用chsh
。
#4楼
You can change the passwd file directly for the particular user or use the below command 您可以直接为特定用户更改passwd文件,或使用以下命令
chsh -s /usr/local/bin/bash username
Then log out and log in 然后注销并登录
最后
以上就是外向白开水为你收集整理的在Linux中更改默认Shell的全部内容,希望文章能够帮你解决在Linux中更改默认Shell所遇到的程序开发问题。
如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。
发表评论 取消回复