usermod command instructions

1, Command Overview

usermod command modifies the user's information. usermod command are not allowed to change user account name line. When usermod command to change the user id, you must confirm the name of the user did not perform any procedures.

2, the command syntax

usermod [options] [username] 

3, command options

-c <Note>: Notes user account to modify the text;
-d <directory sign>: Modify the home directory when the user logs in;
-e <expiration date>: Modify account expiration date;
-f <buffer days>: modified how many days after the password expires, ie close the account;
-g <group>: modify the group the user belongs;
-G <group>; modify additional groups the user belongs;
the -l <account name>: modify the user account name ;
-L: lock user password so that the password is invalid;
-s <shell>: modify the user login shell used;
-u <UID>: modify user ID;
-U: password lock is released.

4, an example of command

4.1 -c modify user remarks information:

[root@lzg ~]# tail -1 /etc/passwd
Jerry:x:5003:5003::/home/Jerry:/bin/bash
[root@lzg ~]# usermod -c jerry Jerry
[root@lzg ~]# tail -1 /etc/passwd
Jerry:x:5003:5003:jerry:/home/Jerry:/bin/bash

4.2 -d modify the user's home directory:

[root@lzg ~]# tail -1 /etc/passwd
Jerry:x:5003:5003:jerry:/home/Jerry:/bin/bash
[root@lzg ~]# mkdir /home/jerry
[root@lzg ~]# usermod -d /home/jerry/ Jerry
[root@lzg ~]# tail -1 /etc/passwd
Jerry:x:5003:5003:jerry:/home/jerry/:/bin/bash

4.3 -g modify the user belongs to the group:

[root@lzg ~]# tail -1 /etc/passwd
Jerry:x:5003:5003:jerry:/home/jerry/:/bin/bash
[root@lzg ~]# usermod -g 5002 Jerry
[root@lzg ~]# tail -1 /etc/passwd
Jerry:x:5003:5002:jerry:/home/jerry/:/bin/bash

 

 

Guess you like

Origin www.cnblogs.com/liuzgg/p/12012150.html