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 create users and groups in Linux

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

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

This article introduces the knowledge of "how to create users and groups in Linux". Many people will encounter this dilemma in the operation of actual cases, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!

The main task of user management is to establish a legitimate user account, set and manage the user's password, modify the properties of the user account, and delete the abandoned user account if necessary.

1) add a new user

On Linux systems, only root users can create a new user, and the following command creates a new user with the login name user1.

# useradduser1

However, this user has not been able to log in because it has not been given an initial password, and users without a password cannot log in to the system. By default, a new user home directory with the same user name will be created under the / home directory.

In Linux, adding a user creates a new group with the same name as the user, and the user is a member of the group. If you want new users to belong to an existing group, you can use the following command:

# useradd-gusergroup1user1

This makes the user a member of the usergroup1 group. And if you want it to belong to another group usergroup2, use:

# useradd-Gusergroup2user1

After you have done this, you should also use the passwd command to set an initial password for it.

2) Delete a user

To delete a user, use a simple command, "userdel user name". However, the files left on the system are also deleted, and you can use the "userdel-r user name" to do this.

3) add a group

We can create user groups according to our own needs:

Groupadd

4) Delete a group

Similarly, we sometimes need to delete a group whose command is groupdel.

That's all for "how to create users and groups in Linux". Thank you for reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!

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

Servers

Wechat

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

12
Report