Created
December 27, 2019 19:49
-
-
Save TerenceLiu98/44eb0ed32a84df9874c9cf659df9b674 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
basepath=$(cd `dirname $0`; pwd) | |
cat $basepath/name.txt | while read line | |
#eampty the user.txt | |
#echo /dev/null > echo basepath/user.txt | |
do | |
echo "The user name is : ${line}" | |
echo | |
echo | |
echo "Now we add ${line} into user" | |
sleep 2 | |
password=`echo $(date +%s%n)$RANDOM|md5sum |cut -c 2-9` | |
sudo adduser "${line}" << ENDX | |
$password | |
$password | |
First Last | |
Y | |
ENDX | |
echo | |
echo | |
echo -e "user: \t${line} passwd:$password" >> $basepath/user.txt | |
echo "The users password is $password" | |
echo | |
echo | |
chage -d 0 ${line} | |
done | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment