move user password change to separate file, email hcoop-sysadmin
[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
13cat /tmp/kadmin.out | grep '\(Password for .* changed\|Cannot reuse password while changing password\)'
14sudo rm -f /tmp/kadmin.out