In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-06 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
The editor today takes you to understand how to use the useradd command in Linux to add users. The knowledge points in the article are introduced in great detail. Friends who feel helpful can browse the content of the article with the editor, hoping to help more friends who want to solve this problem to find the answer to the problem. Let's follow the editor to learn more about "how to use the useradd command to add users in Linux".
It's easy for a Linux system administrator to add or remove a user. Here's how to use the useradd command in Linux to add a user.
The two most important files used by the 1.Linux system to record user names and passwords are / etc/password and / etc/shadow (by default, only root users have the right to read this file, and it is impossible for others to read this file at all)
2.UID is a number used to distinguish between different users.
GID is an ID used to distinguish between different user groups.
Under Linux, each user belongs to at least one group.
To confirm your UID, use the id command to view it.
To confirm which user group you belong to, you can confirm it with the groups command.
3. New user: useradd
For example, to add a user named john.
Useradd john
For the system, completing this command requires performing a lot of imperceptible behavior in the background.
First of all, the system needs to record the user information in / etc/password, usually appending a record at the end of / etc/password and / etc/shadow, and assigning the user a UID.
Next, you will automatically create a home directory for the user. The home directory takes the created user name as the directory name, and the path created is in the / home directory. For example, in the above case, the directory created would be / home/john.
Then, copy all the files under / etc/skel to / home/john. To be clear, if you use the ls-l / etc/skel command to check, you can see that there is nothing in this directory, but in fact, there are many hidden files under this directory, and you can see several files in it by using ls-la / etc/skel.
Finally, create a new user group that is the same as the user name.
Usage:
Use the-u parameter to specify UID for the user
Useradd-u 555 user1
Specify the GID of the new user
Useradd-g user1 group1
Specify the home directory of the new user
Useradd-d / home/mydir3 user3
Modify a user's password
Password
Thank you for reading, the above is the whole content of "how to use the useradd command to add users in Linux". Friends who learn to learn to do it quickly. I believe that the editor will certainly bring you better quality articles. Thank you for your support to the website!
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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.