6 PWFILE
=/var
/lib
/portal
/$USERNM
8 if test -z "$USERNM"; then
9 echo Usage
: create-user-wrapper USERNAME
\'NAME SURNAME
\' [EMAIL
]
13 if test -z "$REALNM"; then
14 echo Usage
: create-user-wrapper USERNAME
\'NAME SURNAME
\' [EMAIL
]
23 /afs
/hcoop.net
/common
/etc
/scripts
/create-user
$USERNM || \
24 ( echo "create-user $USERNM failed" && exit 2 )
27 # Entry in LDAP is created, set real name
30 dn: uid=$USERNM,ou=People,dc=hcoop,dc=net
34 " | sudo ldapmodify
-x -D cn
=admin
,dc=hcoop
,dc=net
-y /etc
/ldap.secret || \
35 (echo Error modifying LDAP entry
&& exit 3 )
38 # Now set the password
40 if ! test -r "$PWFILE"; then
41 echo "Skipping password set from $PWFILE (doesn't exist or permission denied)"
44 echo Setting password from
$PWFILE
45 sudo sh
-c "cat $PWFILE | tee -| /afs/hcoop.net/common/etc/scripts/change-user-password $USERNM" || \
46 ( echo "cat $PWFILE | tee - | change-user-password $USERNM failed" && exit 5 )
48 # Delete password file
50 echo "Not deleting $PWFILE. Enable it in the script when you want"
55 # Set email forwarding
57 if test -z "$EMAILADDR"; then
58 echo "Skipping email forwarding, no email address was specified."
60 echo setting email forward to
"$EMAILADDR"
61 FORWARD_PATH
=$
(sh
-c "echo ~$USERNM/.public/.forward")
62 echo "$EMAILADDR" > $FORWARD_PATH || \
63 ( echo "Failed to set forward address" && exit 6 )
64 chown
$USERNM $FORWARD_PATH