Sixth chapter user account and group management

Source: Internet
Author: User

Sixth chapter user account and group management


Section I user classification

  • Super User

    Root:x:0:0:root:/root:/bin/bash


    for user

    x 0 0 /root
    user name
    is root
    x means
    has password
    user ID

    Comment
    user home directory The first
    program
    executed after logging on to the system
  • Normal User

    Thomas:x:1000:1000:thomas:/home/thomas:/bin/bash


    Thomas X 1000 1000 Thomas /home/thomas /bin/bash
    User name
    For Thomas
    X indicates
    Have a password
    User ID Group ID With the user
    Related to
    Comments
    User home Directory After logging in to the system
    Implementation of the first
    A program


Section II User account creation and management


  1. Create a user account

    Useradd user1

  2. Create a user password

    passwd user1

    650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M02/73/CC/wKiom1YH38Hxzwz-AAHQKZLyulk371.jpg "title=" 1.png " Width= "615" height= "255" border= "0" hspace= "0" vspace= "0" style= "width:615px;height:255px;" alt= " Wkiom1yh38hxzwz-aahqkzlyulk371.jpg "/>

  3. View user Information

    ID User1

    650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M02/73/C9/wKioL1YH4NzRx7OOAABocxPTAl8574.jpg "title=" 2.png " Width= "615" height= "border=" 0 "hspace=" 0 "vspace=" 0 "style=" width:615px;height:44px; "alt=" Wkiol1yh4nzrx7ooaabocxptal8574.jpg "/>

  4. View files for user information

    cat/etc/passwd

  5. View files that hold user password information

    Cat/etc/shadow

  6. Delete a user account

    Userdel user1 the deletion will only User1 from /etc/passwd The configuration file is deleted,

    and User1 directory is not deleted, the directory remains in the /Home directory.

    Userdel-r user1

    The /etc/passwd configuration file is deleted, and the /home/user1 directory is deleted.


  7. Create a virtual user account

    A virtual user account that can only access a specific directory without the permission to log on to the system.

    vim/etc/passwd

    opens the/etc/passwd file, finds the User1:x:1001:1001::/home/user1:/bin/bash line,

    after entering insert mode , change its/bin/bash to /sbin/nologin, and then save to exit.

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M00/73/CC/wKiom1YH5C7iLOypAAMDzr8r9zI732.jpg "title=" 3.png " Width= "615" height= "178" border= "0" hspace= "0" vspace= "0" style= "width:615px;height:178px;" alt= " Wkiom1yh5c7iloypaamdzr8r9zi732.jpg "/>


Section III User group creation and management


  1. create user group

    650) this.width=650; "Src=" http://s3.51cto.com/wyfs02/M01/73/CE/ Wkiom1yie57bk-isaaa2jlwddps412.jpg "title=" 4.png "width=" 615 "height=" "border=" 0 "hspace=" 0 "vspace=" 0 "style=" width:615px;height:33px, "alt=" wkiom1yie57bk-isaaa2jlwddps412.jpg "/>

    < Span style= "font-family: ' The song Body '; >

  2. create user group password

    < Span style= "font-family: ' The song Body '; >GPASSWD public

    650" this.width=650; "src=" Http://s3.51cto.com/wyfs02/M00/73/CE/wKiom1YIe__y8QNmAABzVwO6SwQ903.jpg "title=" 5.png "width=" 615 "height=" 80 " Border= "0" hspace= "0" vspace= "0" style= "width:615px;height:80px;" alt= "wkiom1yie__y8qnmaabzvwo6swq903.jpg"/>

  3. View User group information

    Cat/etc/group

    650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M02/73/CB/wKioL1YIfHOxsLeWAADsPCjo-DQ950.jpg "title=" 6.png " Width= "615" height= "237" border= "0" hspace= "0" vspace= "0" style= "WIDTH:615PX;HEIGHT:237PX;" alt= " Wkiol1yifhoxslewaadspcjo-dq950.jpg "/>

  4. View security group account information

    Cat/etc/gshadow

  5. Modify Group Name

    Groupmod-n test public will change the public group name to test

  6. Delete a group

    GROUPDESL Test


Section Fourth user accounts and group management


  1. User account added to group

    Gpasswd-a User1 public Add user account User1 to the public group

  2. Delete User in Group

    gpasswd-d user1 public to remove user account User1 from the public group

  3. You can add user accounts directly to a group when creating a user account, provided that the group first creates a good

    Useradd-g Shanghai User1 create User1 and add User1 to Shanghai Group

  4. Add user accounts to multiple groups at the same time

    Useradd-g shanghai,beijing User2 will user2 account added to Shanghai and Beijing two groups at the same time



Sixth chapter user account and group management

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.