Created
December 1, 2014 09:22
-
-
Save hupili/681492719f9ae78c4e78 to your computer and use it in GitHub Desktop.
Programmably regenerate passwords for users (Ubuntu)
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 | |
# Usage: put list of users in "users" file. | |
# one user per line. | |
# Passwords will be changed and stored in "passwd.list" | |
rm -f passwd.list | |
for user in `cat users` | |
do | |
password=`echo "sdf982ci237986ahah:$user" | sha1sum | cut -c1-16` | |
echo $user | |
echo $password | |
echo "$user:$password" | chpasswd | |
echo "Linux changed" | |
echo -e "$password\n$password" | smbpasswd -a -s $user | |
echo "Samba changed" | |
echo "$user $password" >> passwd.list | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment