Step 1# Add users in below file
vim users.txt
mansoor
user1
user2
:wq
Step 2# vim useradd.sh
#!/bin/bash
for user in `cat users.txt`
do
useradd -g groupname -d /data/$user $user
pass=`tr -dc A-Za-z0-9 < /dev/urandom | head -c 6 | xargs`
echo -e $pass | passwd --stdin $user
echo "Username: $user Password: $pass"
done
vim users.txt
mansoor
user1
user2
:wq
Step 2# vim useradd.sh
#!/bin/bash
for user in `cat users.txt`
do
useradd -g groupname -d /data/$user $user
pass=`tr -dc A-Za-z0-9 < /dev/urandom | head -c 6 | xargs`
echo -e $pass | passwd --stdin $user
echo "Username: $user Password: $pass"
done
No comments:
Post a Comment