Last active
June 22, 2016 22:15
-
-
Save miticojo/1a5a6ca1990e4be54f244deee683f7ab to your computer and use it in GitHub Desktop.
change all user password with a random 8 chars string and print in csv format
This file contains 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 | |
random-string() | |
{ | |
cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w ${1:-32} | head -n 1 | |
} | |
for u in $(ipa user-find --sizelimit 200 --pkey-only "." | grep ":" | awk '{print $3}'); do | |
psw=$(random-string 8) | |
echo $psw | ipa user-mod $u --password > /dev/null 2>&1 | |
[ "$?" == "0" ] && echo "$u,$psw" | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment