In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-13 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 add a batch of users to 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.
The Linux system provides tools to create a large number of users, which allows you to create a large number of users immediately, as follows:
(1) first edit a text user file.
Each column is written in the format of the / etc/passwd password file. Note that each user's user name, UID, and host directory can not be the same, in which the password field can be left blank or enter the x number. A sample file, user.txt, contains the following:
User001::600:100:user:/home/user001:/bin/bashuser002::601:100:user:/home/user002:/bin/bashuser003::602:100:user:/home/user003:/bin/bashuser004::603:100:user:/home/user004:/bin/bashuser005::604:100:user:/home/user005:/bin/bashuser006::605:100:user:/home/user006:/bin/bash
(2) execute the command / usr/sbin/newusers as root, import data from the newly created user file user.txt, and create a user:
# newusers < user.txt
You can then execute the command vipw or vi / etc/passwd to check that the / etc/passwd file has data for these users and that the user's host directory has been created.
(3) execute command / usr/sbin/pwunconv.
Decode the shadow password generated by / etc/shadow, then write back to / etc/passwd, and delete the shadow password field of / etc/shadow. This is to facilitate the next step of password conversion, that is, to cancel the shadow password function first.
# pwunconv
(4) Editing each user's password comparison file.
The sample file passwd.txt is as follows:
User001: password user002: password user003: password user004: password user005: password user006: password
(5) execute the command / usr/sbin/chpasswd as root.
Create a user password, and chpasswd writes the password encoded by the / usr/bin/passwd command to the password field of / etc/passwd.
# chpasswd < passwd.txt
(6) after determining that the password is encoded and written into the password field of / etc/passwd.
Execute the command / usr/sbin/pwconv to encode the password as shadow password and write the result to / etc/shadow.
# pwconv
This completes the creation of a large number of users, and then you can go to / home to check that the permission settings for these user host directories are correct, and log in to verify that the user password is correct.
This is the end of the article on "how to add bulk users to 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.
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.