Guest User

Untitled

a guest
Nov 14th, 2018
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.58 KB | None | 0 0
  1. #!/usr/bin/env bash
  2. set -o errexit
  3. set -o pipefail
  4. set -o nounset
  5. #set -o xtrace
  6. UFILE="/home/yourdir/users.txt"
  7. TFILE="/tmp/out.tmp.$$"
  8. OFILE="/home/yourdir/credentials.txt"
  9. for line in $(cat ${UFILE})
  10. do
  11. echo "User name: ${line} ... generating password"
  12. sleep 5
  13. mkpasswd -l 8 -s 0 >> ${TFILE}
  14. done
  15. paste -d':' ${UFILE} ${TFILE} > ${OFILE}
  16. echo "New passwords have been generated for the users!!"
  17. rm ${TFILE}
  18. sleep 5
  19. echo
  20. echo "Passwords will now be reset ......."
  21. sleep 5
  22. echo
  23. cat ${OFILE} > chpasswd
  24. sleep 5
  25. echo
  26. echo "User account passwords have been reset"
  27. exit
Add Comment
Please, Sign In to add comment