linux-detailed user and group management

Source: Internet
Author: User
Tags md5 encryption

User Category:

Admin: 0

System users: 1-499

Ordinary users: the researcher

Group Category:

Administrators group: 0

System Group: 1-499

General Group: Researcher

Linux files related to users and groups:

/ETC/PASSWD: User's account information

/etc/shadow: User password and related account settings

/etc/group: Group account information


I../etc/passwd file

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M00/6C/01/wKioL1U9z9bBvTHzAACZ7phTDDI752.jpg "title=" 1.jpg " alt= "Wkiol1u9z9bbvthzaacz7phtddi752.jpg"/>

The passwd file is composed of 7 parts, separated by the ":" Number.

Login account: Password dot: uid:gid: Comment Information: Home directory: Default Shell interface


Ii../etc/group Documents

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M00/6C/02/wKioL1U91qDwKSWFAABOYjr_y1Q088.jpg "title=" 11.jpg "alt=" Wkiol1u91qdwkswfaaboyjr_y1q088.jpg "/>

The group file consists of 4 parts, separated by the ":" Number.

Group name: group password dot: GID: A list of users that belong to this group (multiple users are separated by commas, and users with this group are listed as additional groups).


Iii../etc/shadow file

650) this.width=650; "style=" float:left; "src=" http://s3.51cto.com/wyfs02/M00/6C/02/ Wkiol1u91ybdoeyhaachpvrxx5e851.jpg "title=" 111.jpg "alt=" Wkiol1u91ybdoeyhaachpvrxx5e851.jpg "/>



The shadow file is composed of 9 parts, separated by the ":" Number.

User name: encrypted password (MD5 encryption): The last time the password was modified: password minimum Age: Password maximum age: Password Expiration warning interval: password inactivity period: Account expiration: Reserve an alternate area.



User Add Command: Useradd

-U UID: Specifies the UID to add

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M02/6C/02/wKioL1U92K7iS1E6AACCofIYunY652.jpg "title=" 12.jpg "alt=" Wkiol1u92k7is1e6aaccofiyuny652.jpg "/>

-G GID: Specifies the base group for adding users

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M00/6C/06/wKiom1U92IjzR8JLAACoIuHSd-k309.jpg "title=" 15.jpg "alt=" Wkiom1u92ijzr8jlaacoiuhsd-k309.jpg "/>

-G GID: Specifies additional groups for adding users

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M02/6C/06/wKiom1U92UaSDUcEAACmGd5-DJw996.jpg "title=" 16.jpg "alt=" Wkiom1u92uasduceaacmgd5-djw996.jpg "/>

-C ' COMMENT ': Specify annotation information when adding users

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M02/6C/06/wKiom1U92l6yCb3wAACVpEp4Ouw940.jpg "title=" 17.jpg "alt=" Wkiom1u92l6ycb3waacvpep4ouw940.jpg "/>

-d/path/to/somewhere: Specifies the user home directory.

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M02/6C/02/wKioL1U93Hqx63fkAAHx__l20rQ365.jpg "title=" 13.jpg "alt=" Wkiol1u93hqx63fkaahx__l20rq365.jpg "/>

Note: The specified directory will have a warning message if it exists beforehand. The files in the home directory are copied from/etc/skel.


-S Shell: Specifies that the user uses that Shell interface, only the shell that exists in the/etc/shells file

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M01/6C/02/wKioL1U93T2jEH3-AAD3dfcpza0122.jpg "title=" 14.jpg "alt=" Wkiol1u93t2jeh3-aad3dfcpza0122.jpg "/>

-r: Create System User (UID is between 1-499)

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M01/6C/06/wKiom1U93DWQQ6ZeAACaiJd2aVw992.jpg "title=" 161. JPG "alt=" wkiom1u93dwqq6zeaacaijd2avw992.jpg "/>


Groupadd command:

-G GID: Specifies the GID to create the group

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M00/6C/02/wKioL1U93fiToN4CAABl61iLjgw245.jpg "title=" 121. JPG "alt=" wkiol1u93fiton4caabl61iljgw245.jpg "/>

-R: Creating a System Group

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M00/6C/06/wKiom1U93OzzNrHxAABxlXygBbg492.jpg "title=" 1212. JPG "alt=" wkiom1u93ozznrhxaabxlxygbbg492.jpg "/>


passwd command:

Ordinary users can only modify their own password, the administrator is unrestricted.

Administrator to change the password format:

passwd [Username]

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M02/6C/06/wKiom1U93auSLbvCAADSqUTFtmg937.jpg "title=" 21.jpg "alt=" Wkiom1u93auslbvcaadsqutftmg937.jpg "/>

Note: This example has a simple new password, so there is a reminder message.

-L: Lock user

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M02/6C/07/wKiom1U932ejyoQEAACxr8C2H6U968.jpg "title=" 31.jpg "alt=" Wkiom1u932ejyoqeaacxr8c2h6u968.jpg "/>

Note: The user is locked, the password field will have 2 in front of it!!

-U: Unlocking the user

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M00/6C/07/wKiom1U934izCW2mAAClpu0bQc4617.jpg "title=" 32.jpg "alt=" Wkiom1u934izcw2maaclpu0bqc4617.jpg "/>

--stdin: Change password directly from standard input

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M02/6C/03/wKioL1U94jmCMhnWAACA9Ev2WgI025.jpg "title=" 33.jpg "alt=" Wkiol1u94jmcmhnwaaca9ev2wgi025.jpg "/>


Userdel: Deleting users

-r: Delete user and home directory

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M00/6C/03/wKioL1U94xyT3lOxAADV_hYd-9k533.jpg "title=" 34.jpg "alt=" Wkiol1u94xyt3loxaadv_hyd-9k533.jpg "/>


Groupdel: Deleting a group

Groupdel GROUPNAME

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M01/6C/07/wKiom1U94mGSEJlbAAC3NRPmnZ4314.jpg "title=" 35.jpg "alt=" Wkiom1u94mgsejlbaac3nrpmnz4314.jpg "/>


Usermod: Modify User

-U uid: Modify user UID

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M00/6C/03/wKioL1U95EzhDq-FAAC7eDgOkVo155.jpg "title=" 36.jpg "alt=" Wkiol1u95ezhdq-faac7edgokvo155.jpg "/>

-G GID: Modify user base Group

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M02/6C/03/wKioL1U95QPTwmWcAAC2afUsblY663.jpg "title=" 37.jpg "alt=" Wkiol1u95qptwmwcaac2afusbly663.jpg "/>

Note: The modified group must exist beforehand

-G: Modifies the user's additional group, which is typically used with-A to modify additional groups in an append manner. -A in front of-g

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M02/6C/03/wKioL1U95ZySQoxAAACKFZ8ecCU071.jpg "title=" 38.jpg "alt=" Wkiol1u95zysqoxaaackfz8eccu071.jpg "/>


-D: Modify the user home directory, which can be used with-m, to create a new home directory and move the user's home directory files to the new home directory.

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M01/6C/03/wKioL1U95rWg9Hw7AAKLWiDp_J0908.jpg "title=" 38.jpg "alt=" Wkiol1u95rwg9hw7aaklwidp_j0908.jpg "/>

-S: Modify Shell interface

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M00/6C/03/wKioL1U95wDQ6PxgAADNs0_Lalg628.jpg "title=" 39.jpg "alt=" Wkiol1u95wdq6pxgaadns0_lalg628.jpg "/>

-L: Modify user Name

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M02/6C/07/wKiom1U95fCxZ2R9AADSmQegDJM043.jpg "title=" 40.jpg "alt=" Wkiom1u95fcxz2r9aadsmqegdjm043.jpg "/>

Note: This option is the same as CHSH username


To view user information:

ID username

-U: Show user ID

-G: Show basic groups

-G: Show all groups (include basic and additional groups)

-N: This option is displayed with a name instead of a digital display when used with other options above

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M01/6C/07/wKiom1U953eDcWs1AACU-JSSotQ740.jpg "title=" 41.jpg "alt=" Wkiom1u953edcws1aacu-jssotq740.jpg "/>

To modify a group:

Groupmod:

-G GID

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M01/6C/07/wKiom1U95_LSFY4CAADECJAY2_E214.jpg "title=" 42.jpg "alt=" Wkiom1u95_lsfy4caadecjay2_e214.jpg "/>

-N New_group_name

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M00/6C/03/wKioL1U96afRbyecAACdOPfVk_0701.jpg "title=" 43.jpg "alt=" Wkiol1u96afrbyecaacdopfvk_0701.jpg "/>




This article is from "The Blood of the Linux blog" blog, please be sure to keep this source http://xuezhonghua.blog.51cto.com/10167373/1639276

linux-detailed user and group management

Related Article

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.