Last active
January 31, 2024 14:55
-
-
Save hoangdh/7ce503b5f27701412eb9c2f7e81b8099 to your computer and use it in GitHub Desktop.
Sync password hash from another system to Zimbra.
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 | |
| FILE=$1 | |
| if [ -e $FILE ] | |
| then | |
| cat $FILE | while read -r l | |
| do | |
| text=`echo $l | sed "s/(//g; s/'//g; s/)//; s/;//g; s/)//g; s/,//g"` | |
| USER=$(echo $text | awk '{print $1}') | |
| PASS=$(echo $text | awk '{print $2}') | |
| USERNAME=$(echo $USER | awk -F '@' '{print $1}') | |
| #flag=$(echo "$PASS1" | grep -E '^\$') | |
| #if [ -n "$flag" ] | |
| #then | |
| echo "zmprov ca $USER TemppasswordQAZXSW displayName $USERNAME" | |
| echo "zmprov ma $USER userPassword '{crypt}$PASS'" | |
| #fi | |
| done | |
| else | |
| echo "$FILE: File not exist." | |
| fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
File example:
file1.txtRUN:
Output: