The information of the user group in the system is recorded in Etc/group, with: As delimiter, the first column is the group name of the user group, the second column is the user group password, this setting is used for the user group Administrator, but the password is recorded in Etc/shadow, so the password column in Etc/group will only display as X , the third column is the GID, which is the user group ID, and the fourth column is a member of the user group.
Initial user group: When the user logs on to the system, the user group will have the relevant rights immediately, and the user group corresponding to the GID in the fourth column of the user information in ETC/PASSWD is the user's initial user group.
[Email protected] ~]$ tail-n 1/etc/groupxxx:x:502:[[email protected] ~]$ tail-n 1/etc/passwdxxx:x:502:502::/home/xxx: /bin/bash
For example, when a user xx is added to WHX and xxx Two user groups, then in the read/write/execute existing files, for the user Group section, xxx This account can have WHX and xxx Two user groups have the function. But when xxx This user creates a new file or directory, the xxx new file or directory can only belong to the valid user group of XXX, not the initial user group of XXX.
Use the Groups command to view all user groups that are supported by the current user, and the first user group is a valid user group for that user.
Use the NEWGRP command to change a user's valid user group (only for the user group that the user supports).
[Email protected] ~]$ groupsxxx whx[[email protected] ~]$ touch Test[[email protected] ~]$ lltotal 0-rw-rw-r--. 1 xxx xxx 0 Oct 9 01:27 test [[Email protected]~]$ newgrp whx[[email protected] ~]$ groupswhx xxx[[email protected] ~]$ t Ouch Test1[[email protected] ~]$ lltotal 0-rw-rw-r--. 1 xxx xxx 0 Oct 9 01:27 test-rw-r--r--. 1 xxx whx0 Oct 9 01:27 test1
This article is from the "Dark Shun" blog, please make sure to keep this source http://mjal01.blog.51cto.com/12140495/1970957
Linux Switch User Group