Linux: user and group file explanation (/etc/passwd,/etc/shadow,/etc/group,/etc/gshadow)

Source: Internet
Author: User
1. user File: etcpasswd [root @ pinfun6 ~] Catetcpasswdroot: x: 0: 1. user File:/etc/passwd
[Root @ pinfun6 ~] # Cat/etc/passwdroot: x: 0: 0: root:/root: /bin/bash 1 2 3 4 5 6 7 | -- the default SHELL used by the user ||||| | -- the user's home directory | -- user finger information (Comment Information) | -- user group ID (GID) | -- user ID (UID) | -- password placeholder (the password is saved in the/etc/shadow file) | -- user name

Add user command: useradd [option]... This file is operated by USERNAME.

The default/home/USERNAME Directory of the new user is stored in the/etc/skel directory.

II. user password file:/etc/shadow

[Root @ pinfun6 ~] # Cat/etc/shadowroot: $1 $. TZS2yur $ uQ3.5XLbdEhLkak9HKqZx/: 16042: 0: 99999: 7: Blank 1 2 3 4 5 6 7 8 9 |||||| -- reserved field, currently blank | -- User Expiration Date (unit/day). This field specifies the number of days the user has expired (from January 1, to the present) | -- how many days after the password expires to disable this user | -- how many days in advance to warn that the user password will expire |||| -- twice the maximum number of days for password modification ||||-- the minimum interval between two password modifications |||-- the last password change time (unit/day ), days from January 1, January 01, 1970 to the present | -- user password (corresponding to the password placeholder in the/etc/passwd file), if the password is added "!"" Indicates disabling this user | -- user name (corresponding to the user name in the/etc/passwd file) Note: When the values of fields 4, 5, 6, 7, and 8 are empty, the account can be used permanently.

Set user password command: passwd [option]... USERNAME operation is this file.

3. user group File:/etc/group

[Root @ pinfun6 ~] # Cat/etc/grouproot: x: 0: root | -- additional groups (multiple groups can be separated by commas (,) | -- Group ID (GID) | -- Group password placeholder | -- group name
Add Group Command: groupadd [option]... GROUPNAME

II. user group File:/etc/gshadow

[Root @ pinfun6 ~] # Cat/etc/gshadowroot: Blank: blank: root | -- group members separated by commas | -- group administrators separated by commas | -- encrypted password | -- group name

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.