Skip to content

Instantly share code, notes, and snippets.

@mrkurt
Created April 5, 2011 23:37
Show Gist options
  • Save mrkurt/904812 to your computer and use it in GitHub Desktop.
Save mrkurt/904812 to your computer and use it in GitHub Desktop.
#!/bin/bash
SHADOW_FILE="/etc/shadow"
DATE=$(( $(date -u '+%s') / 60 / 60 / 24 ))
REPLACEMENT=$(echo "account-$1:$2:$DATE:0:99999:7:::" | sed -e 's/\(\/\|\\\|&\)/\\&/g')
sed -i "s/^account-$1:.*$/$REPLACEMENT/" $SHADOW_FILE \
&& echo "success"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment