Beginners Learn Linux-user and user group basics

Source: Internet
Author: User
Tags new set

/ETC/PASSWD:

The user's information is saved under/ETC/PASSWD (early in the day, the user's password is also placed in the file.) Later, for security reasons, place the password in/etc/shadow):

/etc/group:

The user group information is saved under/etc/group:

/etc/shadow:

The password information is saved under/etc/shadow:

By ': ', the content of/etc/shadow is layered below (from left to right)

Account name

Password

Date of the most recent password change (from 1970-1-1 onwards, in days)

The number of days the password cannot be changed from the last modified date

The number of days the password needs to be reset (in the example above, 99,999 days)

The number of warning days before the password needs to be reset

The grace period after the password expires and the password is still available during the grace period

Account Expiration Date

Reserved (for future expansion)

Initial and valid groups:

A user can belong to more than one user group, then this brings a problem, when the user creates a file or folder, then the user group of the file or folder should be? In fact, the GID recorded below/etc/passwd is the ID of the initial group. When a user logs on, they have the initial group permissions. The user group for a file or folder is determined by the effective group of the creator. We can view the user groups of the current user through the groups command, the first is the effective group, see the following example:

We can change the active group of the current user by newgrp groupname . It is important to note that when this command is used, a new bash process is actually started, and the new active group is only effective in the new bash process. After returning to the original bash process, the new set of valid groups is invalidated, as in the following example:

Beginners Learn Linux-user and user group basics

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.