Usermod Introduction to Commands:
Modify user account properties .  
1 . command format:
usermod [option] USERNAME
2 . Command function:
3. Command parameters:
-U uid modifies the UID of the user
-G GID Modifying the user's GID must be a group that already exists
-a-g GID : Does not use the-a option to overwrite previous additional groups;
-C Add comment information to the user
-d-m : Specify a new home directory,-M to represent and copy files from the home directory to the new home directory
(Cannot access files without the-M original home directory)
-S Modify the user's login shell
-L Modify the user's login name usermod-l newusername oldusername
- L : Lock Account
- u : Unlock Account
4. Command instance:
1, new user test, password test, plus add usertest Group
#useradd test #echo "Test" | passwd--stdin Test #groupadd usertest
2. Add test user to Usertest Group
#usermod-ag usertest Test # #多个组之间用空格隔开 #id Test uid=500 (Test) gid=500 (test) groups=500 (501)
3, modify the jack user's home directory
[Email protected] test1]# Usermod-md/home/jack Jack
[Email protected] test1]# TAIL-N3/ETC/PASSWD
Oprofile:x:16:16:special user account to being used by Oprofile:/home/oprofile:/sbin/nologin
Donggen:x:500:500::/home/donggen:/bin/bash
jack:x:777:500: User to test user administration commands:/home/jack:/bin/bash home directory has changed to/home/jack
4. Modify User Name
#usermod-L urchin (new user name) test (original user name) #id urchin uid=500 (urchin) gid=500 (test) groups=500 (test), 501 (usertest)
This article is from the "Learn Linux history" blog, please be sure to keep this source http://woyaoxuelinux.blog.51cto.com/5663865/1861120
Linux command: Usermod