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

Source: Internet
Author: User

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: 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.