Get the App
SLTechnology News&Howtos  ›  Servers  › 

How to add users in bulk with shel script

Shulou Source: shulou.com Published: 2022-06-01 03:04:32 11月14日 Update

This article is about how shel scripts add users in bulk. The editor thinks it is very practical, so share it with you as a reference and follow the editor to have a look.

Scripts are often used in enterprises to manage a lot of users in batches, which can also be understood as automatic management. Prepare for automatic operation and maintenance deployment after the enterprise.

#! / bin/bash

# description:useradd

# Author by xxb-Andy.

# Date 11/8/2014

For i in `seq 1 20`; do

Useradd user$i

Echo user$i | passwd-- stdin user$i > / dev/null 2 > & 1

Chage-d 0 user$i

Done

20 users are added by default, and the user name and password are user$, first login users need to change the password forcefully.

Thank you for reading! This is the end of the article on "how to add users in bulk with shel script". 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, you can share it for more people to see!

Tags: User script enterprise content password more article management good practical article user name look knowledge secondary login preparation reference help compulsion related Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Shulou Tech Info vpn Shulou Technology Apple Huawei