I have 2 files. vi usernames
user2
user3
user4
vi passwords
pw2
pw3
pw4
I make script that add users and set passwords form files.
#!/bin/bash
for i in `cat /root/o/usernames`;
do
if [ -z `getent passwd $i` ]
then
useradd $i
echo user $i added
cat /root/o/passwords | passwd $i --stdin
else
echo user $i is exist
fi
#done
when this script is run add users and set password pw1 all users. But i want to set multiple password each user. How can i make?
How can i make set multiple password each users from file?