Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What is the difference and function between the effective user group and the initial user group in Linux system

2025-02-23 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/01 Report--

What this article shares to you is about the difference and function between the effective user group and the initial user group in the Linux system, the editor thinks it is very practical, so I share it with you to learn. I hope you can get something after reading this article.

The following explains the valid user groups and initial user groups in Linux

1. / etc/group file description

Section 1 is the account name, which matches the paragraph 1 in the / etc/passwd file

Segment 2 is a group password, which generally does not need to be set.

Paragraph 3 is GID.

Paragraph 4 is a list of members in the group, separated by a comma in English

For example, there are two users mail and postfix in the default mail group

2. Query the contents of oracle users in the passwd,shadow,group file

3. On this test machine, the running result of the command grep / etc/passwd / etc/shadow / etc/group is as follows:

Copy the contents to the clipboard

/ etc/passwd:oracle ❌ 54321:54321::/home/oracle:/bin/bash

/ etc/shadow:oracle:yxkNIulf$nYTPPqi/VgXFh6QdH4yZAHAB5NMz7CimNITDUUpUPKZYr0.m.KrZNcfkDX16O3

C9puotrCMH2IKY5Kjfl.blh/:16785:0:99999:7:::

/ etc/group:dba ❌ 54322:oracle

4. Valid user group (effective group) and initial user group (initial group). The permissions of this initial user group are handled according to the permissions of the initial user group for the files that already existed before the system startup. The fourth paragraph of the passwd file is the initial user group, and the user logs in to the system with the permission of this group.

5. Valid user group (effective group)

If it is a file created after the system starts, does the permission inherit the initial user group or the valid user group? Linux stipulates that it is a valid user group. how to query the valid user group of the current user?

# # use the groups command. Note that this is group+s.

# # Note that if the groups command has more than one output, the first output is a valid user group.

6. How to modify the valid user group of the current user?

Use newgrp+ group name

# if the current user is root, if you enter the command: newgrp users

# modify the valid user group of the current user root

# the result of using groups user output is

Users root

The above is the difference and function between the effective user group and the initial user group in the Linux system. The editor believes that there are some knowledge points that we may see or use in our daily work. I hope you can learn more from this article. For more details, please follow the industry information channel.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report