Automating Users and Passwords

Hey guys in this simple post i will show you how you could easily create passwords of multiple users with a simple script.

!/bin/bash
 file=/user.txt
 for i in more $file
 do
 useradd $i
 newpass=mkpasswd
 echo "user $i added successfully"
 echo "$newpass" | passwd --stdin "$i"
 echo "password for user $i is $newpass"
 done

Just create a file user.txt in / directory and add users to this file.

give executable permissions to the file and run by typing e.g
# sh file.sh

Thanks,

Salman A. Francis
https://youtube.com/linuxking
https://facebook.com/linuxking77
Insta: Linuxking77
Twitter: @Linuxking77

Leave a Reply

Your email address will not be published. Required fields are marked *

Impact Financial

Good draw knew bred ham busy his hour. Ask agreed answer rather joy nature admire wisdom.

Latest Posts

  • All Posts
  • Amazon
  • Amazon EFS
  • apache
  • AWS
  • aws backup
  • aws cli
  • aws cli version 2
  • aws sync
  • Banking
  • bash scripting
  • Budgeting
  • cloud
  • cyber attack
  • cyber scam
  • database
  • efs
  • Email
  • Email Client
  • Email Server
  • Insurance
  • Investing
  • Learning
  • lets encrypt
  • Linux
  • php
  • pip
  • postgresql
  • python
  • S3
  • s3 buckets
  • scam prevention
  • scams
  • security
  • ssl
  • Tax Strategies
  • Troubleshooting
  • website
  • wordpress
  • wordpress setup
    •   Back
    • Linux tips
    •   Back
    • nextcloud
    •   Back
    • Rainloop

Categories

Tags