Linux command: Usermod

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.