Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on May 2nd, 2012  |  syntax: None  |  size: 0.58 KB  |  hits: 30  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. #!/bin/bash
  2.  
  3. # to set passwords in a username and password file
  4. # Each $line is "username"
  5. # passwords are generated and added as second variable in csv file
  6.  
  7. # Path to the file with users that need passwords
  8. Users="/Users/rzm102/Desktop/users.txt"
  9. # Path to the file with users and generated passwords
  10. UsersAndPasswords="/Users/rzm102/Desktop/userspass.txt"
  11.  
  12. while read line
  13. do
  14. new_password=`openssl rand -base64 6`
  15. #/usr/bin/dscl -u diradmin -p password /LDAPv3/127.0.0.1 -passwd /Users/"$line $new_password"
  16. echo "$line, $new_password" >> "$UsersAndPasswords"
  17. done < "$Users"