You are here
Home > Redhat > Add users using bash script in linux

Add users using bash script in linux

First of all create two files one contains username and other
passwords. here i'm using file users as username file and file pass as
password file and script is:

#!/bin/bash

arr=(`cut -f1 users`)

for i in `cat pass`

do

useradd ${arr[$x]};

echo $i|passwd –stdin ${arr[$x]};

x=$[$x+1];

done

Leave a Reply

8 + 12 =

Top