Use of Linux usermod command

Use of Linux usermod command

1. Command Introduction

The usermod (user modify) command is a system administrator command used to modify a user account.

usermod can be used to modify various settings of user accounts and modify system account files to reflect changes specified through the command line.

2. Command format

usermod [OPTIONS] LOGIN

3. Option Description

-c, --comment
Add backup information -d, --home HOME_DIR
The user's new home directory -e, --expiredate EXPIRE_DATE
Set the account expiration date -f, --inactive INACTIVE
After INACTIVE days, set the password to invalid state -g, --gid GROUP
Force GROUP to be the new primary group -G, --groups GROUPS
New additional group list GROUPS
-a, --append GROUP
Add the user to the additional groups mentioned in -G above, without removing the user from other groups -h, --help
Display this help message and launch -l, --login LOGIN
new login name -L, --lock
Lock user account -m, --move-home
Move the contents of your home directory to a new location (only used with -d)
-o, --non-unique
Allow duplicate (non-unique) UIDs
-p, --password PASSWORD
Set the encrypted password (PASSWORD) as the new password -s, --shell SHELL
The new login shell for this user account
-u, --uid UID
New UID for the user account
-U, --unlock
Unlock user account -Z, --selinux-user SEUSER
New SELinux user mapping for user accounts

4. Common Examples

(1) Modify the user's home directory.

usermod -d /home/tom tom

(2) Change the user's uid.

usermod -u 888 tom

(3) Change the user name to jerry.

usermod -l jerry tom

(4) Lock the tom user.

usermod -L tom

(5)Unlock the tom user.

usermod -U tom

(6) Add new additional groups.

usermod -G deng tom

(7) Modify the user login shell.

usermod -s /bin/sh tom

(8) Modify the user's GID.

usermod -g 1003 tom

(9) Specify the account expiration date.

usermod -e 2020-12-31 tom

(10) Specify the number of days after the user account password expires before disabling the account.

usermod -f 3 tom

The above is the detailed content of the use of Linux usermod command. For more information about Linux usermod command, please pay attention to other related articles on 123WORDPRESS.COM!

You may also be interested in:
  • Linux gzip command compression file implementation principle and code examples
  • gzip command in linux
  • Usage of Linux userdel command
  • Use of Linux date command
  • How to run Linux commands in the background
  • Use of Linux ls command
  • Use of Linux read command
  • Use of Linux chkconfig command
  • Use of Linux passwd command
  • Use of Linux ln command
  • Linux cut command explained
  • Use of Linux gzip command

<<:  Detailed analysis of MySQL master-slave replication

>>:  Three common uses of openlayers6 map overlay (popup window marker text)

Recommend

Vue implements small notepad function

This article example shares the specific code of ...

HTTP return code list (Chinese and English explanation)

http return code list (below is an overview) for ...

CentOS 7 method to modify the gateway and configure the IP example

When installing the centos7 version, choose to co...

How to use html table (to show the visual effect of web page)

We know that when using HTML on NetEase Blog, we ...

How to fix some content in a fixed position when scrolling HTML page

This article mainly introduces how some content i...

The specific use and difference between attribute and property in Vue

Table of contents As attribute and property value...

Tips for implementing multiple borders in CSS

1. Multiple borders[1] Background: box-shadow, ou...

Linux installation MySQL5.6.24 usage instructions

Linux installation MySQL notes 1. Before installi...

webpack -v error solution

background I want to check the webpack version, b...

Detailed process of installing and configuring MySQL and Navicat prenium

Prerequisite: Mac, zsh installed, mysql downloade...

MySQL 5.6.23 Installation and Configuration Environment Variables Tutorial

This article shares the installation and configur...

CSS to achieve Tik Tok subscription button animation effect

I was watching Tik Tok some time ago and thought ...

Detailed explanation of the usage of compose function and pipe function in JS

Table of contents compose function Array.prototyp...

ElementUI implements cascading selector

This article example shares the specific code of ...