Linux常用命令-chsh

命令

chsh

描述

change your login shell
更改登录shell

用法

1
chsh [options] [username]

选项

1
2
3
Options:
-s 指定shell
-l 显示当前系统支持的shell

注意

示例

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# 显示当前系统支持的shell
$ chsh -l
/bin/sh
/bin/bash
/usr/bin/sh
/usr/bin/bash
$ more /etc/shells
/bin/sh
/bin/bash
/usr/bin/sh
/usr/bin/bash
# 查看当前使用的shell
$echo $SHELL
/bin/bash
# 更改用户shell
$ chsh -s /bin/sh usera
Changing shell for usera.
Shell changed.
# 验证passwd配置
$ grep ^usera /etc/passwd
usera:x:1002:1002::/home/usera:/bin/sh
# 或
$ getent passwd usera
usera:x:1002:1002::/home/usera:/bin/sh