17370845950

linux更改登录shell是什么-chsh命令使用与实例

Linux chsh命令

Linux 中的 chsh 命令用于变更用户的登录 shell 设置。

适用权限:所有用户均可使用。

命令格式

shell>> chsh

使用示例

shell>> chsh
Changing fihanging shell for user1
Password: [del]
New shell [/bin/tcsh]: ### [当前正在使用的 shell]
[del]
shell>> chsh -l ### 显示 /etc/shells 文件内容
/bin/bash
/bin/sh
/bin/ash
/bin/bsh
/bin/tcsh
/bin/csh

修改当前 shell。假设当前 shell 为 /bin/bash,使用 chsh 命令将其更改为 /bin/csh。

# chsh
Changing shell for root.
New shell [/bin/bash]: /bin/csh //输入新的 shell 路径
Shell changed.

使用 -s 参数来设置新的登录 shell

# chsh -s /bin/csh //将当前 shell 设置为 /bin/csh
Changing shell for root.
Shell not changed.