• 要找福利?记不住网址?搜不到?如何与我们保持联系?试试 CTRL+D 把零点博客添加进您的浏览器收藏夹,一键直达永不失联!

系统管理-Linux chsh命令

linux系统 涛涛 89次浏览 0个评论

Linux chsh命令

Linux 命令大全 Linux 命令大全

Linux chsh命令用于更改使用者 shell 设定。

使用权限:所有使用者。

语法

<span class="pln">shell</span><span class="pun">>></span><span class="pln"> chsh</span>

实例

<span class="pln">shell</span><span class="pun">>></span><span class="pln"> chsh
</span><span class="typ">Changing</span><span class="pln"> fihanging shell </span><span class="kwd">for</span><span class="pln"> user1
</span><span class="typ">Password</span><span class="pun">:</span> <span class="pun">[</span><span class="kwd">del</span><span class="pun">]</span>
<span class="typ">New</span><span class="pln"> shell </span><span class="pun">[</span><span class="str">/bin/</span><span class="pln">tcsh</span><span class="pun">]:</span> <span class="com">### [是目前使用的 shell]</span>
<span class="pun">[</span><span class="kwd">del</span><span class="pun">]</span><span class="pln">
shell</span><span class="pun">>></span><span class="pln"> chsh </span><span class="pun">-</span><span class="pln">l </span><span class="com">### 展示 /etc/shells 档案内容</span>
<span class="pun">/</span><span class="pln">bin</span><span class="pun">/</span><span class="pln">bash
</span><span class="pun">/</span><span class="pln">bin</span><span class="pun">/</span><span class="pln">sh
</span><span class="pun">/</span><span class="pln">bin</span><span class="pun">/</span><span class="pln">ash
</span><span class="pun">/</span><span class="pln">bin</span><span class="pun">/</span><span class="pln">bsh
</span><span class="pun">/</span><span class="pln">bin</span><span class="pun">/</span><span class="pln">tcsh
</span><span class="pun">/</span><span class="pln">bin</span><span class="pun">/</span><span class="pln">csh</span>

改变当前的shell。当前的shell 设置为//bin/bash,通过chsh命令,改变shell的设置/bin/csh。

<span class="com"># chsh</span>
<span class="typ">Changing</span><span class="pln"> shell </span><span class="kwd">for</span><span class="pln"> root</span><span class="pun">.</span>
<span class="typ">New</span><span class="pln"> shell </span><span class="pun">[</span><span class="str">/bin/</span><span class="pln">bash</span><span class="pun">]:</span> <span class="pun">/</span><span class="pln">bin</span><span class="pun">/</span><span class="pln">csh </span><span class="com">//输入新的shell地址</span>
<span class="typ">Shell</span><span class="pln"> changed</span><span class="pun">.</span>

通过 -s 参数改变当前的shell设置

<span class="com"># chsh -s /bin/csh //改变当前设置为 /bin/csh</span>
<span class="typ">Changing</span><span class="pln"> shell </span><span class="kwd">for</span><span class="pln"> root</span><span class="pun">.</span>
<span class="typ">Shell</span> <span class="kwd">not</span><span class="pln"> changed</span><span class="pun">.</span>

欢迎转载本文:系统管理-Linux chsh命令
喜欢 (0)
[ld]
分享 (0)
发表我的评论
取消评论
表情 贴图 加粗 删除线 居中 斜体 签到

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址