6

Linux usermod 命令修改用户默认Shell

 1 year ago
source link: https://www.myfreax.com/linux-usermod-command-to-modify-user-default-shell/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

Linux usermod 命令修改用户默认Shell

Shell是Linux/UNIX操作系统传统的用户和计算机的交互接口

Updated At 13 Nov 2022 2 min read
By myfreax
Linux usermod 命令修改用户默认Shell

Linux usermod 命令修改用户默认Shell

Shell是Linux/UNIX操作系统传统的用户和计算机的交互接口。可以让用户直接输入命令来执行各种各样的任务。

你可以运行cat命令打印/etc/shells文件的内容,找到系统可用的Shell程序。

默认Shell程序是登录系统后运行的Shell程序。在大多数Linux系统,默认shell设置为Bash Shell。

usermod是一个命令行程序,可让您修改用户的登录信息和所属组。本教程介绍如何使用usermod命令修改用户默认Shell。

usermod命令的语法形式是usermod [options] USERoptionsusermod命令的选项,是一个可选参数。USER是Linux系统用户名。

只有root用户或具有sudo权限的用户才能运行usermod命令并修改用户帐户。usermod成功后不打印任何输出,且退出代码是0。

要更改用户的默认Shell程序,请使用usermod命令的-s选项。后接Shell程序的绝对路径和用户名。

例如命令sudo usermod -s /usr/bin/zsh myfreax,将会修改用户myfreax的默认Shell为Zsh。

#usermod -s SHELL USER
cat /etc/shells
sudo usermod -s /usr/bin/zsh myfreax
usermod-command-in-linux.webp
Linux usermod命令修改用户信息与组

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK