Create 10 system accounts in bulk under Linux with a password set to a random string

Source: Internet
Author: User
Tags stdin

#!/bin/sh

For n in ' Seq-s ""-W 10 '

Do

Passwd= ' echo $RANDOM |md5sum |cut-c 1-8 '

Useradd username$n && echo $passwd |passwd--stdin username$n

Done


by Seq-s ""-W 10 with Digital loop 01 02 03 04 ...


Using the system environment variable $random, take the random character, Cut-c take the front 1-8 bits

echo $RANDOM |md5sum |cut-c 1-8


Setting a password via--stdin

echo $passwd |passwd--stdin username$n


This article is from the "11002498" blog, please be sure to keep this source http://11012498.blog.51cto.com/11002498/1860208

Create 10 system accounts in bulk under Linux with a password set to a random string

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.