Last active
August 29, 2015 14:24
-
-
Save ion1/69e11c87e0add48237c9 to your computer and use it in GitHub Desktop.
passwd-reset
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/sh | |
| set -eu | |
| umask 077 | |
| for username; do | |
| password="$(pwgen -n 16 1)" | |
| printf '%s:%s\n' "$username" "$password" | chpasswd | |
| chage -E "$(( ($(date '+%s') / 86400) + 2 ))" "$username" | |
| passwd -e "$username" | |
| printf '%s:%s\n' "$username" "$password" | |
| done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment