slightly non-idempotent: chown -R $USER:nogroup in create-user
[hcoop/scripts.git] / change-user-password
1 #!/bin/bash -ex
2 #
3 # Finally, set password for main user's principal
4 # Aborting this operation is harmless. Just re-invoke cpw.
5 #
6 # kadmin.local doesn't report errors properly, so we have to
7 # check manually
8 #
9 USER=$1
10 sudo rm -f /tmp/kadmin.out
11 sudo kadmin.local -p root/admin -q "cpw $USER@HCOOP.NET" \
12 2>&1 | tee /tmp/kadmin.out
13 cat /tmp/kadmin.out | grep '\(Password for .* changed\|Cannot reuse password while changing password\)'
14 sudo rm -f /tmp/kadmin.out