Linux Users and Groups

Source: Internet
Author: User

I. Account Overview 1, account the real Linux operating system is a multi-user operating system, which allows multiple users to log on to the system at the same time, using system resources. The system differentiates each user's files, processes, and tasks according to the account, giving each user a specific working environment (such as the user's working directory, SHELL version, and the configuration of the X-window environment) so that each user's work can be independently and undisturbed. 2. Users and groups broadly speaking, Linux accounts include user accounts and group accounts. User AccountsThere are two types of user accounts on Linux: normal user accounts and Superuser accounts (root). Normal user account---the normal user account on the system task is to do normal work, Super User account---Administrator's task on the system is to manage the general user and the entire system. The Administrator account has absolute control over the system and is capable of doing everything to the system. group AccountsA group is a collection of users, there are two types of groups in the system: private and standard, and when a user is created, no group is established for it, and Linux creates a private group with the same name as the user, which only contains the user. If you are using a standard group, define which group to belong to when you create a new user. When a user belongs to more than one group, the group they belong to after landing is called the primary group, and the other groups are called additional groups. Second, the Linux environment account system files in the Linux environment Account system files are mainly/etc/passwd,/etc/shadow,/etc/group,/etc/gshadow four files. 1,/etc/passwd/etc/passwd each row defines a user account that is readable to all users. A row is divided into multiple fields to define the different attributes of the user account, separated by ":" Between the name segments. The meaning of each field in the/etc/passwd file user name         user name used when logging in to the system, is the only password in the system            Store encrypted password, password is x, this indicates that the user's password is protected by the/etc/shadow file user identification number     internal system used to identify the user, UID for each user is unique root user uid number is 0, normal user from                500 starting from 1-499 is the standard account for the system. The group identification number       is used internally to identify the group annotative description that the user belongs to      such as the user's full name and other information host directory        User Login system after entering the Directory command interpretation        indicates that the user uses the Shell,linux default is the Bash 2,/etc/ SHADOW/ETC/PASSWD files are readable to any user, in order to increase the security of the system, the user's password is usually protected with shadow passwords. /etc/shadow only for RootUsers can read. Meaning of the fields in the/etc/shadow file user name                         User's account name password                           user's password is the time of the last modification that was added to the secret             from January 1, 1970 onwards, the minimum time interval for the number of days the user last changed the password                    from January 1, 1970 onwards, Maximum time interval to the number of days that a user can change a password                   from January 1, 1970 onwards, the number of days you must change the password warning time                       How many days before the password expires remind users to update inactive time                     the number of days to disable an account after the user password expires                      from January 1, 1970 onwards, The number of days that the account is disabled flag                           reserved bit 3,/etc/group user grouping is a means by which Linux manages and controls access to users. There can be multiple users in a group, and one user can belong to more than one group. The file is readable to all users. The meaning of each field in the/etc/group file group name       Group name Group Password     user group password, x for GID     Identification number of the     group, membership     members of the Group 4,/etc/gshadow the file is used to define user group password, group administrator, and so on, the file is only readable by the root user. The meaning of each field in the/etc/gshadow file group name                Group name group Password              user group password, save Administrator account for encrypted password group   Admin account for      Group, Admin has permission to add, delete account group member               members of the group, multiple users with ', ' separate three, manage accounts under the graphical interface 1, create user accounts open ' main Menu '-' System settings '-' users and Groups '-' users ', in this interface input: Username full password Login ShellHost directory user ID private Group 2, create group account open ' main Menu '-' System settings '-' users and Groups '-' group ', enter: Group name Group ID Number group member 3, modify user account and group account four, use command line tools to manage account 1, User Account Maintenance command useradd (user name)                    Create a default new user Useradd –g (group name) (user name)         add a group useradd-s (shell name) (username) when creating a user account     Specify shelluseradd-d (user directory) when creating a user account (user name)     Specify user directory Useradd-u (UID number) (username) when creating user accounts        Specify UID number useradd-p (password) (user name) when creating user accounts         Specify password usermod–g (group name) when creating user account (user name)         Modify user join a group usermod-s (shell name) (username)      Modify User shellusermod-d User directory (user name)     Modify User directory Usermod-u (new UID number) (username)    Modify user UID ID usermod-p (password) (username)         Modify user password usermod-l (new login) (old login)   Modify user login name Usermod -L (user name)                 Lock user account Usermod-U (user name)                 Unlock user account Userdel (username)                      Delete user account Userdel-r (username)                  Delete user account when deleting user Directory 2, Group account Maintenance command Groupadd (group account name)                   Create a new group account GROUPADD-R (System group account name)           Create a System group account GROUPMOD-G (new GID) (group account name)    Change the GID number groupmod-n (new group name) (the old group name) to change the reorganization account name Groupdel (group account name)  & nbsp;               Delete the specified group account 3, Password Maintenance command passwd (user account name)                   Set User password gpasswd-a (user account name) (group account name) adds a user to the specified group gpasswd-d (user account name) (group account name) removes the user from the specified group gpasswd-a (user account name) (group account name) designates the user as the group's Administrator 4, User and Group Status command SU (user name) &NBsp;                          Switch User account ID (user name)                            Displays the UID of the user, Gidwhoami                                  displays the name of the current user groups (user name)                        Show the group newgrp the user belongs to (the group account that the user belongs to)             Convert the user's current group to the established 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.