Linux system command Learning-user management

Source: Internet
Author: User

1. User

A) The system uses the user ID referred to as UID to mark the uniqueness of users

b) The user is divided into three categories: system users, root users, ordinary users

        i.  Normal User

      1. uid greater than 500, the system default normal user UID starting from 500

      2. You can only manipulate your own home directory, temporary directory, and other authorized directory operations

        ii.   root User (root), super user

      1. uid is 0

      2. Full control over the system

III. System users

      1. UID Range 1-499

      2. Used to run the system, and not necessarily a user who is actually present


2. User groups

A) The system uses group ID abbreviation (GID) to differentiate user groups

b) Each user belongs to at least one user group and can belong to more than one group


3. View common commands for user IDs and user groups

ID command for viewing user information, without parameters for the current user


You can see the UID and GID of the current user and the group name

    1. Groups command, you can view the group information that the user belongs to, see the current user's group information without parameters


2. who command, you can see all users currently logged in

Currently only the root user is logged in and the WHO command executes the following results:



Re-login with Admin user, then execute who command, see the following results



3. User Management

Added users: useradd

The use of the method is simple, after the command with the user name to add, such as to add User1, using the Useradd user1,useradd command to create a user ID starting from 1000



View New User Information

Use the ID command to view the newly added user information, ID user1



You can see that the UID of User1 is 1001, the same as the default created a User1 group with the same name, the group ID is also 1001

Then we went down to the home directory and found that a User1 home directory was created at the same time.



These are the simplest applications for useradd, so can we specify the UID and user groups, as well as the user's home directory? The answer is yes.

Let's do it. Use the-u parameter to specify the UID with the-G parameter to specify the user group, the-d parameter specifies the user's home directory, below we create a UID is 501, belongs to the User1 group, the home directory is/home/user22 user User3

Useradd-u 502-g user1-d/home/user22 User3



You can see that the user has been created according to our set parameters.

More articles about the public number "kick genius"


Linux system command Learning-user management

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.