Linux user and group management

Source: Internet
Author: User

Files related to linux user and group management:/etc/passwd/etc/group/etc/shadow/etc/gshadow/etc/passwd where the user account is stored, each line represents an account, and ":" is used as the Separator in one line. The meaning of each field is as follows: root: x: 0: 0: root:/bin/bash Username: Password (the current password is stored in the shadow file separately, this field is useless): User ID: Group ID: Description: Home Directory: shell path/etc/shadow information stored in account and password root: xxoo @! %: 14127: 0: 99999: 7: User name: Password (encrypted): Last modification date: days that cannot be modified: days that need to be modified: warning days before modification: account grace time after Password Expiration: Account Expiration date: retained (temporarily meaningless)/etc/group information root: x: 0: root group name: group password: Group ID: users in this group (multiple users are separated by commas (,). Note: No space)/etc/gshadow root ::: root group name: Password: User Group Administrator Account: member accounts of the user group (multiple accounts are separated by commas) Common commands: view the information of the currently logged on user: id: view the information of a user: id user_name view the current user group: groups view all users in a group: cat/etc/gshadow | grep group_name or cat/etc/group | grep group_name It is the fourth column of the separator, that is, all the accounts of the reorganization. Multiple accounts are separated by commas.) view all groups of a user: cat/etc/gshadow | grep user_name or cat/etc/group | grep user_name: useradd user_name or specify useradd-g group_name user_name in A group | Change User Password: passwd [user_name] (after this command is executed, you will be prompted to output the password, and then confirm the password, if you change the password, you will be prompted to enter the old password. If no account is followed, the current user's password is modified.) Delete the user userdel [-r] user_name (if the parameter-r is included, delete it together with the user's home directory) add group: groupadd group_name Delete group: groupdel group_name modify the group to which the user belongs: usermod-g target_group_name user_name Add a user to another user group without modifying the original user group: usermod-a target_group_name user_name or gpasswd-a user_name group_name delete a user from a group: gpasswd-d user_name group_name modify the group to which the file or directory belongs: user of chgrp group_name file_name to modify the file or directory: chown user_name file_name to modify the user and group of the file or directory: chown user_name: group_name file_name user group switch: newgrp group_name

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.