Ubuntu 修改用户的 Shell & 添加用户时指定 Shell

jupiter
2021-01-13 / 0 评论 / 763 阅读 / 正在检测是否收录...
温馨提示:
本文最后更新于2021年01月13日,已超过1199天没有更新,若内容或图片失效,请留言反馈。

Ubuntu 修改用户的 Shell & 添加用户时指定 Shell

修改用户的 Shell

如果你没有管理员权限, 那么你只能修改自己的 Shell, 输入 chsh 命令.

chsh

这时你会获得提醒, 要求输入新的 Shell 应用路径. 如果你要换成 bash, 请输入 /bin/bash 并回车确认.

Enter the new value, or press ENTER for the default
Login Shell [/bin/sh]:/bin/bash

如果你是牛逼的管理员, 那么恭喜你, 除了使用 chsh 命令, 你还可以通过修改配置文件批量修改.

 vim /etc/passwd

打开 /etc/passwd 文件, 你将看到所有用户及其使用的 Shell, 会有很多行类似这样的内容, 每行是一个用户.

jupiter:x:1000:1000:jupiter,,,:/home/jupiter:/bin/sh

这里只需要件 /bin/sh 改成 /bin/bash 即可.

jupiter:x:1000:1000:jupiter,,,:/home/jupiter:/bin/bash

添加用户时指定 Shell

useradd -s /bin/bash {用户昵称}

参考资料

  1. 修改 Ubuntu 用户的 Shell:https://blog.csdn.net/fightforyourdream/article/details/17609337
0

评论 (0)

打卡
取消