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 (18 years, 11 months ago) by douglas
Content type: text/x-sh
File size: 1397 byte(s)
Log Message:
Master!

File Contents

# Content
1 #!/usr/bin/env bash
2 # Douglas Thrift
3 #
4 # CCS Computer Science
5 #
6 # Add User
7
8 source '/ccs/bin/common.sh'
9
10 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
14 $ldapadd -D "uid=root,ou=People,$BASE" -H "$MASTER" -x -y $SECRET <<EOF
15 dn: uid=$USER,ou=People,$BASE
16 objectclass: top
17 objectclass: account
18 objectclass: posixAccount
19 objectclass: shadowAccount
20 objectclass: ucsbCcsLoginShells
21 objectclass: sambaSamAccount
22 cn: $NAME
23 uid: $USER
24 uidNumber: $ID
25 gidNumber: $ID
26 homeDirectory: /home/$USER
27 userPassword: `$slappasswd -T $FILE`
28 $SHELLS
29 sambaPwdLastSet: `$date '+%s'`
30 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 $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
51 $smbpasswd -s $USER

Properties

Name Value
svn:executable *