First check the /etc/group file: [root@localhost /]# cat /etc/group root:x:0:root bin:x:1:root,bin,daemon daemon:x:2:root,bin,daemon sys:x:3:root,bin,adm adm:x:4:root,adm,daemon tty:x:5: disk:x:6:root lp:x:7:daemon,lp mem:x:8: kmem:x:9: wheel:x:10:root ... Each line of this file represents a user group, with colons separating the fields. There are 4 fields in total, namely:
Initial User Group The fourth field (GID) of the line corresponding to the user in /etc/passwd is the initial user group. When a user logs into the system, he or she immediately has the relevant permissions of this initial user group. [root@localhost /]# cat /etc/passwd root:x:0:0:root:/root:/bin/bash bin:x:1:1:bin:/bin:/sbin/nologin daemon:x:2:2:daemon:/sbin:/sbin/nologin adm:x:3:4:adm:/var/adm:/sbin/nologin lp:x:4:7:lp:/var/spool/lpd:/sbin/nologin sync:x:5:0:sync:/sbin:/bin/sync shutdown:x:6:0:shutdown:/sbin:/sbin/shutdown halt:x:7:0:halt:/sbin:/sbin/halt mail:x:8:12:mail:/var/spool/mail:/sbin/nologin ... Valid User Groups The effective user group indicates the user group that the user belongs to at this moment. Before the effective user group is switched, the effective user group is the initial user group. If you want to know the user's current effective user group and supported user groups (the fourth field in the /etc/group file contains the user's user group), use groups. [root@localhost /]# groups root bin daemon sys adm disk wheel In this output information, the first user group output is the current effective user group (but some systems do not do this). If I create a new file with touch, the owner of the file is root, and the user group is root (the effective user group). Switch effective user group: newgrp Use the newgrp command to switch the effective user group. Note that you can only switch the user groups supported by the current account. Assume that the current user supports the two user groups "test" and "foo". Then newgrp test and newgrp foo are valid. Everything else is invalid. The principle behind this conversion is to create a new shell. If you want to restore to the previous user group, you need to use exit or Ctrl+D to log out of the current shell. The above is the full content of this article. I hope it will be helpful for everyone’s study. I also hope that everyone will support 123WORDPRESS.COM. You may also be interested in:
|
<<: Detailed explanation of the entry-level use of MySql stored procedure parameters
>>: Summary of uncommon operators and operators in js
Table of contents Preface 1. Trigger Overview 2. ...
Table of contents Overview console.log console.in...
Custom Image FAQ How to view the data disk? You c...
Since myeclipse2017 and idea2017 are installed on...
This article introduces the CSS scrollbar selecto...
This article uses examples to describe the manage...
Table of contents Overview Getting started with d...
Learning Linux commands is the biggest obstacle f...
1. What is HTML HTML (HyperText Markup Language):...
Table of contents 1. Index Basics 1.1 Introductio...
This article example shares the specific code of ...
After this roll call device starts calling the ro...
Due to the default bridge network, the IP address...
This article records the specific method of insta...
Table of contents 1. Create a Hadoop directory in...