hcoop-backup: Update log location.
[clinton/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
31a0d668 7for USERHOME in `ssh $ADMIN@fyodor.hcoop.net cd /home\; sudo 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 ======================================================================
31a0d668 12 echo ssh $ADMIN@fyodor.hcoop.net "sudo cat /home/$USER/.mire-password"
13 ssh $ADMIN@fyodor.hcoop.net "sudo cat /home/$USER/.mire-password" || \
93993a60 14 (echo == sending complaint to $USER@hcoop.net ====================================================;\
659cff0d 15 cat /etc/migration-prob-message |\
93993a60 16 mail -a 'From: Adam Megacz <megacz@hcoop.net>' \
17 -c admins@hcoop.net \
659cff0d 18 -s "HCoop.net automatic account creation output" $USER@hcoop.net)
31a0d668 19 ssh $ADMIN@fyodor.hcoop.net 'sudo cat /home/$USER/.mire-password' && \
e1441848 20 create-user $USER && \
31a0d668 21 (ssh $ADMIN@fyodor.hcoop.net "(sudo cat /home/$USER/.mire-password;echo)|head -n 1;(sudo cat /home/$USER/.mire-password;echo)|head -n 1" |\
93993a60 22 change-user-password "$USER") && \
e1441848 23 (echo == account created successfully ========================================================
b03d3c1e 24 echo == deleting .mire-password =============================================================
31a0d668 25 ssh $ADMIN@fyodor.hcoop.net "sudo rm /home/$USER/.mire-password; sudo touch /home/$USER/.mire-password"
6e5619be 26 echo == sending email to $USER@hcoop.net ====================================================
e1441848 27 echo w00t |\
28 mail -a 'From: Adam Megacz <megacz@hcoop.net>' \
bf9d5f7b 29 -s "account created for user $USER" admins@hcoop.net
e1441848 30 mail -a 'From: Adam Megacz <megacz@hcoop.net>' \
31 -s 'your account on mire.hcoop.net has been created' $USER@hcoop.net <<EOF
6e5619be 32Enjoy!
33
34______________________________________________________________________________
35BETA STATUS
36
37Please remember that mire accounts are still in "beta testing", so we
38cannot (yet) guarantee uptime or service. Please do not migrate
39any important services to your mire account.
40
41______________________________________________________________________________
42SSH Access
43
44You can access your new account by typing:
45
46 ssh $USER@mire.hcoop.net
47
48... using the password previously in fyodor:~/.mire-password. For
49security, that file has been blanked out.
50
51______________________________________________________________________________
52AFS (direct) Access
53
54Your AFS filespace is located at:
55
56 /afs/hcoop.net/user/$PATHBITS/
57
58If you like, you can access this storage directly from your local
59machine, without having to use ssh or scp. To do so, follow the
60instructions at the link below, substituting "HCOOP.NET" and
61"hcoop.net" for the realm name and cell name, respectively.
62Capitalization matters.
63
64 http://research.cs.berkeley.edu/doc/afs/
65
66Sincerely,
67
68 - your hcoop admins
69
70EOF
71 echo
72 echo
73 echo
b03d3c1e 74 )
75done