Update apache-sync-logs script
[hcoop/scripts.git] / change-user-password
CommitLineData
e1441848 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#
9USER=$1
10sudo rm -f /tmp/kadmin.out
11sudo kadmin.local -p root/admin -q "cpw $USER@HCOOP.NET" \
12 2>&1 | tee /tmp/kadmin.out
08839fa8 13cat /tmp/kadmin.out | grep 'is too short while changing' && \
14 (echo == sending complaint to $USER@hcoop.net ====================================================;\
15 echo 'please change it' |\
16 mail -a 'From: Adam Megacz <megacz@hcoop.net>' \
17 -c admins@hcoop.net \
18 -s "your ~/.mire-password is too short" $USER@hcoop.net) || \
19 true
e1441848 20cat /tmp/kadmin.out | grep '\(Password for .* changed\|Cannot reuse password while changing password\)'
21sudo rm -f /tmp/kadmin.out