Linux basic commands-user account management

Source: Internet
Author: User
Tags md5 encryption

One, user account

    • Superuser: Root,uid is 0 and is the most privileged user in a Linux system.

    • Program User: UID is 1~499, some low-privileged users generated when some programs are installed, generally do not allow logging on to the system.

    • Ordinary users: UID is 500~60000, is created by the administrator, has the permission to be limited, generally only in their own host directory has full permissions.


Second, user account file

The file of the user account is composed of two parts:/etc/passwd and/etc/shadow.

1,/etc/passwd

All account information in the system is stored in the/etc/passwd file. Each row represents a user information, and each user information is composed of 7 parts. ":" is the delimiter.

650) this.width=650; "src=" http://s5.51cto.com/wyfs02/M01/7C/BC/wKiom1bW2DPxLgw1AAA5xiLBfQM501.jpg "title=" 1.jpg " alt= "Wkiom1bw2dpxlgw1aaa5xilbfqm501.jpg"/>

    • First part: User name

    • The second part: User password, "x" on behalf of this user has a password, but will not show the specific content.

    • Part III: UID of the user

    • Part IV: User's GID

    • Part V: The full name of the user

    • Part VI: User's host Directory

    • Part VII: User's login shell


2,/etc/shadow

The shadow file is also known as a shadow file, which holds the password for each user. Each row represents a user information, and each user information is composed of 9 parts. ":" is the delimiter.

650) this.width=650; "src=" http://s1.51cto.com/wyfs02/M00/7C/BB/wKioL1bW2haxR7o3AABH2JUvul8433.jpg "title=" 2.jpg " alt= "Wkiol1bw2haxr7o3aabh2juvul8433.jpg"/>

    • First part: User name

    • The second part: User password, use MD5 encryption, when for "*", "!!" "Indicates that this user cannot log on to the system, and if the field is empty, it means that you can log into the system without a password

    • Part III: The last time the password was changed, representing the number of days from January 1, 1970 to the most recent password change time interval

    • Part IV: Minimum password usage time

    • Part V: Maximum Password usage time

    • Part VI: How many days in advance reminder user password will expire, default is 7 days

    • Part VII: How many days after the password expires this user is disabled

    • Part VIII: Account Expiration time, this field specifies the number of days that the user expires (calculated from January 1, 1970), the default is empty, indicating that the account never expires

    • Ninth part: Reserved field, not yet defined


Third, add, delete, modify user account

1,useradd command--add user

Command format: Useradd "Options" user name

    • -u: Specify UID for user

    • -S: Specify the user's login shell

    • -D: Specify the user's host directory, default to/home

    • -E: Specifies the user's expiration time, which can be used in the YYYY-MM-DD date format

    • -M: Specifies that the user does not establish a host directory

    • -G: Specify the user's base group

    • -G: Specify additional groups for users

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M01/7C/BC/wKiom1bW36PBW4hHAAArj6ovmt8531.jpg "title=" 3.jpg " alt= "Wkiom1bw36pbw4hhaaarj6ovmt8531.jpg"/>


2,PASSWD command--set password for user

Command format: passwd "Options" user name

    • -D: Clears the password for the specified user

    • -L: Lock the specified user

    • -S: View user status

    • -U: Unlock the specified user

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M02/7C/BB/wKioL1bW4ZPzhOLrAABQocXcMLA625.jpg "title=" 4.jpg " alt= "Wkiol1bw4zpzholraabqocxcmla625.jpg"/>

650) this.width=650; "src=" http://s1.51cto.com/wyfs02/M01/7C/BC/wKiom1bW4rHQ0kapAAB-WEh5_XA647.jpg "title=" 5.jpg " alt= "Wkiom1bw4rhq0kapaab-weh5_xa647.jpg"/>


3,usermod command--Modify user account properties

Command format: usermod "Options" user name

    • -U: Modify UID of user

    • -D: Modify the user's host directory

    • -E: Modifies the user's expiration time, which can be expressed using the YYYY-MM-DD date format

    • -G: Modify the user's base group

    • -G: Modify the user's additional group

    • -S: Specify the user's login shell

    • -L: Modify User Login Name

    • -L: Lock user

    • -U: Unlocking the user

650) this.width=650; "src=" http://s5.51cto.com/wyfs02/M00/7C/BC/wKiom1bW5GKTyJZyAABNYW2RD-k249.jpg "title=" 6.jpg " alt= "Wkiom1bw5gktyjzyaabnyw2rd-k249.jpg"/>


4,userdel command--delete user

Command format: Userdel "Options" user name

    • -R: Delete the user's host directory at the same time



This article is from the "New Start" blog, so be sure to keep this source http://yuanshuai.blog.51cto.com/10539781/1746896

Linux basic commands-user account 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.