Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to realize user Management in Linux

2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/02 Report--

This article introduces you how to achieve user management in Linux, the content is very detailed, interested friends can refer to, hope to be helpful to you.

one。 Basic introduction

Linux system is a multi-user and multi-task operating system. Any user who wants to use system resources must first apply to the system administrator for his own account, and then log in to the system with the applied account.

Users of linux belong to at least one user group and can belong to multiple user groups.

two。 Create user 2.1 add user 2.1.1 basic syntax

Useradd [option] user name

2.1.2 Application Ca

Case 1:

Add a user milo

2.1.3 details

When a user is created successfully, a home directory with the same name as the user is automatically created

When you create a user, you can use the useradd-d [directory] user name to specify a home directory for the newly created user

2.2 set / modify password 2.2.1 basic syntax

Passwd user name

2.2.2 Application Ca

Case 1:

Assign a password to a milo user

three。 Delete user 3.1 basic syntax

Userdel user name

3.2 Application Ca

Delete the user milo, but keep the directory

Delete user milo and user home directory

four。 Query user 4.1 query user Information instruction 4.1.1 basic syntax

Id user name

4.1.2 Application example

Query the user information of user milo

five。 Introduction to switching user 5.1

In the operation of Linux, if the current user does not have sufficient permissions, you can switch to a highly privileged user, such as root, by using the su-instruction.

5.2 basic grammar

Su-switch user name

5.3 details

If you switch from a user with high privileges to a user with low privileges, you do not need to enter a password, on the contrary

Use the exit directive when you need to return to the original user

six。 View current user / logged in user 6.1 basic syntax

Whoami/who ami

seven。 Introduction to user Group 7.1

Similar to roles, the system can manage multiple users who have something in common.

7.2 New Group 7.2.1 basic Syntax

Groupadd group name

7.2.2 Application Ca

Create a group: wudang

7.3 Delete group 7.3.1 basic syntax

Groupdel group name

7.4 basic syntax for setting group 7.4.1 when adding new users

Useradd-g user group username

7.4.2 Application Ca

Add a user zwj and directly assign him to the wudang group

7.5 modify user group 7.5.1 basic syntax

Usermod-g user group username

7.5.2 Application Ca

Create a shaolin group, then modify the zwj to the shaolin group

On how to achieve user management in Linux to share here, I hope that the above content can be of some help to you, can learn more knowledge. If you think the article is good, you can share it for more people to see.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report