在Linux中更改默认Shell

本文翻译自: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 然后注销并登录

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值