Linux System user and group management

Source: Internet
Author: User

User and Group Management

Linux is a multi-user multi-tasking network operating system, as a network administrator, it is essential to master the creation and management of user groups.

Learning Essentials:

    • Understand the profiles of users and groups of the group.
    • Familiar with the creation and maintenance management of Linux users.
    • Familiar with the creation and maintenance management of Linux under the cluster.
    • Be familiar with how User Manager is used.

First, the user account (user) under the Linux system mainly consists of 3 kinds of

    1. Super User (Admin User: root)
    2. Normal User (login user, login account): Created by the system administrator, can log on to the Linux system, but only the files within their own directory, limited permissions.
    3. System User: Mainly used for applications, support maintenance system operation, but the system running indispensable users, such as: bin,daemon,adm,ftp and Mail and other user accounts, are built-in users of Linux system (generally do not consider).

#su命令

Function: Transition to another user.

Format: su [-] User name

Note: When you do not specify a user name, you convert to root, and when you specify the-option, the environment is also transformed. When an ordinary user executes Su, it is necessary to enter the user name of the user to be converted.

* New User *

#useradd user1

Function: Create a new user home directory with the same user name by default

#useradd-D/home/xf user1

Function: Specify the user's home directory

#useradd-S/bin/false user1

Function: User Login-"shell program:/bin/bash, if do not want this user to log in, can modify the shell program is:/bin/false, this with the user even if the login can not execute the linux command.

#useradd-G user User1

Function: Specify a group that already exists for the user

#useradd-G user User1

Function: Let the user belong to another group again

Table 1-1

Table 1-2

Modify User

#usermod option User Name

-D: Modify the user's home directory #usermod-D/ljj/user1 user1

-L: Modify the user's account name #usermod-L USER11 user1

-G: Change the user's base group

-G: Change the user's additional group #usermod-G group1 user1

-C: Modify note information

-E: Modify the expiration date of the account

-S: Modify the shell used when logging in

-L: Lock user password

-u: Unlock user password

Delete User

#userdel-R user1

Features: delete users and delete their home directories

Group of Accounts (group)

A group is a collection of users who can share files and other system resources;

The principle of grouping is divided by working relation or user nature;

The correspondence between users and groups is many-to-many, and a group can contain multiple users, with the same group permissions as the group users.

Table 2-1

New User Group

#groupadd Group Name

#groupadd group1

#groupadd group2

#groupadd Group3

#groupadd GROUP4

#groupadd-G GID (group number) Gname (group name)

#groupadd-G 530 group2

Features: New user group

Ways to add users to a group

    1. Specify the GID for this group when creating a new user
    2. Modify the group properties of an existing user with the Usermod command
    3. Modify the passwd and group files directly.
    4. #gpasswd-a group1 user1

Delete a user group

#groupdel user Groups

#groupdel group2

Linux System user and group 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.