ViewVC Help
View File | Revision Log | Show Annotations | Download File | View Changeset | Root Listing
root/repos/CCSAdmin/adduser.sh
Revision: 806
Committed: 2006-06-28T19:53:21-07:00 (19 years ago) by douglas
Content type: text/x-sh
File size: 1397 byte(s)
Log Message:
Master!

File Contents

# User Rev Content
1 douglas 572 #!/usr/bin/env bash
2 douglas 562 # Douglas Thrift
3     #
4     # CCS Computer Science
5     #
6     # Add User
7    
8 douglas 566 source '/ccs/bin/common.sh'
9 douglas 562
10 douglas 806 ID=$((`$ldapsearch -b "ou=People,$BASE" -H "$MASTER" -LLL -S 'uidNumber' \
11     'uidNumber' | $sed -Ee 's/^uidNumber: (1[0-9]{3})$/\1/p;d' | $tail -n 1` \
12     + 1))
13 douglas 562
14 douglas 806 $ldapadd -D "uid=root,ou=People,$BASE" -H "$MASTER" -x -y $SECRET <<EOF
15 douglas 562 dn: uid=$USER,ou=People,$BASE
16     objectclass: top
17     objectclass: account
18     objectclass: posixAccount
19 douglas 572 objectclass: shadowAccount
20 douglas 562 objectclass: ucsbCcsLoginShells
21     objectclass: sambaSamAccount
22     cn: $NAME
23     uid: $USER
24     uidNumber: $ID
25     gidNumber: $ID
26     homeDirectory: /home/$USER
27 douglas 566 userPassword: `$slappasswd -T $FILE`
28 douglas 583 $SHELLS
29 douglas 566 sambaPwdLastSet: `$date '+%s'`
30 douglas 562 sambaAcctFlags: [U ]
31     sambaSID: S-1-5-21-3739982181-3886045993-82308153-$ID
32     sambaPrimaryGroupSID: S-1-5-21-3739982181-3886045993-82308153-$((ID + 1000))
33    
34     dn: cn=$USER,ou=Group,$BASE
35     objectclass: top
36     objectclass: posixGroup
37     objectclass: sambaGroupMapping
38     cn: $USER
39     gidNumber: $ID
40     sambaSID: S-1-5-21-3739982181-3886045993-82308153-$((ID + 1000))
41     sambaGroupType: 4
42     EOF
43    
44 douglas 806 $ldapmodify -D "uid=root,ou=People,$BASE" -H "$MASTER" -x -y $SECRET \
45     <<<"`$ldapsearch -b "ou=Group,$BASE" -LLL 'cn=wheel' | $sed -e \
46     "s/^$/memberUid: $USER/"`"
47     $ldapmodify -D "uid=root,ou=People,$BASE" -H "$MASTER" -x -y $SECRET \
48     <<<"`ldapsearch -b "ou=Group,$BASE" -LLL 'cn=games' | $sed -e \
49     "s/^$/memberUid: $USER/"`"
50 douglas 562
51 douglas 566 $smbpasswd -s $USER

Properties

Name Value
svn:executable *