Linux Switch User Group

Source: Internet
Author: User

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

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.