Shell Bulk Add Users

Source: Internet
Author: User
Tags stdin

Bored to see a face test, requires the shell script to create 100 users, named: student001...student100:

#!/bin/bashfor num in ' seq-w ' Do/usr/sbin/useradd student$num echo ' Password ' |passwd--stdin student$nu Mdone


Also, ask for an account password in a file to be added to the system:

[[email protected] ~]# cat user_lists Jack 123456jami 234567tom 345678

The script is as follows:

#!/bin/bashcat user_lists|while read username Passworddo/usr/sbin/useradd $username echo $password |passwd- -stdin $usernamedone


This article is from the "Bug" blog, please be sure to keep this source http://chongzi100.blog.51cto.com/340243/1590977

Shell Bulk Add Users

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.