chsh 命令
2016-02-15 by dongnan
举个栗子
更改 testgit
账户,登陆 shell
环境为 nologin
。
chsh -s /sbin/nologin testgit
Changing shell for testgit.
Shell changed.
验证
tail -n1 /etc/passwd
testgit:x:503:503::/home/testgit:/sbin/nologin
可以看到 testgit
账户,shell
环境已经更改为 /sbin/nologin
。
帮助
man chsh
NAME
chsh - change your login shell
SYNOPSIS
chsh [-s shell] [-l] [-u] [-v] [username]
DESCRIPTION
chsh is used to change your login shell. If a shell is not given on the command line, chsh prompts for one.
VALID SHELLS
chsh will accept the full pathname of any executable file on the system. However, it will issue a warning if the shell is not
listed in the /etc/shells file. On the other hand, it can also be configured such that it will only accept shells listed in
this file, unless you are root.
OPTIONS
-s, --shell shell
Specify your login shell.
-l, --list-shells
Print the list of shells listed in /etc/shells and exit.
-u, --help
Print a usage message and exit.
-v, --version
Print version information and exit.