move user password change to separate file, email hcoop-sysadmin
[hcoop/scripts.git] / make-account-for-fyodor-user
CommitLineData
b03d3c1e 1#!/bin/bash
2
61ecf9d4 3ADMIN=`whoami | sed s/_.*//`
4echo "assuming that I am $ADMIN@fyodor..."
e1441848 5export PATH=/afs/hcoop.net/common/etc/scripts/:$PATH
61ecf9d4 6
7for USERHOME in `ssh $ADMIN@fyodor.hcoop.net cd /home\; find */.mire-password -size +0`; do
b03d3c1e 8 USER=`dirname $USERHOME`
6e5619be 9 PATHBITS=`echo $USER | head -c 1`/`echo $USER | head -c 2`/$USER
b03d3c1e 10
11 echo == creating user $USER ======================================================================
e1441848 12 create-user $USER && \
13 (ssh $ADMIN@fyodor.hcoop.net cat /home/$USER/.mire-password\; cat /home/$USER/.mire-password |\
14 change-user-password $USER) && \
15 (echo == account created successfully ========================================================
b03d3c1e 16 echo == deleting .mire-password =============================================================
61ecf9d4 17 ssh $ADMIN@fyodor.hcoop.net 'echo -n > /home/$USER/.mire-password'
6e5619be 18 echo == sending email to $USER@hcoop.net ====================================================
e1441848 19 echo w00t |\
20 mail -a 'From: Adam Megacz <megacz@hcoop.net>' \
21 -s "account created for user $USER" hcoop-sysadmin@hcoop.net
22 mail -a 'From: Adam Megacz <megacz@hcoop.net>' \
23 -s 'your account on mire.hcoop.net has been created' $USER@hcoop.net <<EOF
6e5619be 24Enjoy!
25
26______________________________________________________________________________
27BETA STATUS
28
29Please remember that mire accounts are still in "beta testing", so we
30cannot (yet) guarantee uptime or service. Please do not migrate
31any important services to your mire account.
32
33______________________________________________________________________________
34SSH Access
35
36You can access your new account by typing:
37
38 ssh $USER@mire.hcoop.net
39
40... using the password previously in fyodor:~/.mire-password. For
41security, that file has been blanked out.
42
43______________________________________________________________________________
44AFS (direct) Access
45
46Your AFS filespace is located at:
47
48 /afs/hcoop.net/user/$PATHBITS/
49
50If you like, you can access this storage directly from your local
51machine, without having to use ssh or scp. To do so, follow the
52instructions at the link below, substituting "HCOOP.NET" and
53"hcoop.net" for the realm name and cell name, respectively.
54Capitalization matters.
55
56 http://research.cs.berkeley.edu/doc/afs/
57
58Sincerely,
59
60 - your hcoop admins
61
62EOF
63 echo
64 echo
65 echo
b03d3c1e 66 )
67done