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

Linux's method of creating new users and setting passwords

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

Share

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

This article will explain in detail how to create new users and set passwords for linux. The editor thinks it is very practical, so I share it with you as a reference. I hope you can get something after reading this article.

In linux, you can use the useradd username command to create a new user, and then use the passwd username command to set a password for the created user, which you need to enter twice to ensure that the password is correct. The newly created user will create a username directory under "/ home".

Linux creates new users and sets passwords

Create user testuser

Useradd testuser

Set the password for the created user testuser

Passwd testuser

Description: the newly created user will create a user directory testuser under / home

Usermod-- help modifies the relevant parameters of the user's command

Userdel testuser deletes user testuser

Rm-rf testuser deletes the directory where user testuser resides

The above commands can only be used on your root account. If you don't know where the commands on your system are, you can use the following command to find its path:

Locate useradd

After you create a new user, the information about the new user is added to the passwd file in the etc directory

Note: to take a screenshot, I used the tail-3 passwd command here to display only the last three lines of information (which is also my concern) of the file.

User switching under the command line window:

Su user name

Description: su is an acronym for switch user, indicating user switching

Enter "exit" from the new user status to return to the previous user status.

Addition and deletion of user groups:

Addition of groupadd testgroup group

Deletion of groupdel testgroup group

Note: group addition and deletion information will be reflected in the group file in the etc directory.

If you set the shutdown within 10 minutes and do not want to shut down, you can use ctrl+c to terminate the shutdown command.

This is the end of this article on "how to create new users and set passwords for linux". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, please 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

Servers

Wechat

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

12
Report