ViewVC Help
View File | Revision Log | Show Annotations | Download File | View Changeset | Root Listing
root/repos/CCSAdmin/adduser.sh
(Generate patch)

Comparing CCSAdmin/adduser.sh (file contents):
Revision 563 by douglas, 2005-08-28T01:55:06-07:00 vs.
Revision 583 by douglas, 2005-11-21T12:56:05-08:00

# Line 1 | Line 1
1 < #!/usr/local/bin/bash
1 > #!/usr/bin/env bash
2   # Douglas Thrift
3   #
4   # CCS Computer Science
5   #
6   # Add User
7  
8 < LDAPSEARCH='/ccs/bin/ldapsearch'
9 < SED='/ccs/bin/sed'
10 < TAIL='/ccs/bin/tail'
11 < LDAPADD='/ccs/bin/ldapadd'
12 < SLAPPASSWD='/ccs/bin/slappasswd'
13 < DATE='/ccs/bin/date'
14 < LDAPMODIFY='/ccs/bin/ldapmodify'
15 < SMBPASSWD='/ccs/bin/smbpasswd'
8 > source '/ccs/bin/common.sh'
9  
10 < BASE='dc=ccs,dc=ucsb,dc=edu'
11 < SECRET='/ccs/etc/secret'
10 > ID=$((`$ldapsearch -b "ou=People,$BASE" -LLL -S 'uidNumber' 'uidNumber' \
11 >        | $sed -Ee 's/^uidNumber: (1[0-9]{3})$/\1/p;d' | $tail -n 1` + 1))
12  
13 < ID=$((`$LDAPSEARCH -b "ou=People,$BASE" -LLL -S 'uidNumber' 'uidNumber' \
21 <        | $SED -Ee 's/^uidNumber: (1[0-9]{3})$/\1/p;d' | $TAIL -n 1` + 1))
22 <
23 < $LDAPADD -D "uid=root,ou=People,$BASE" -x -y $SECRET <<EOF
13 > $ldapadd -D "uid=root,ou=People,$BASE" -x -y $SECRET <<EOF
14   dn: uid=$USER,ou=People,$BASE
15   objectclass: top
16   objectclass: account
17   objectclass: posixAccount
18 + objectclass: shadowAccount
19   objectclass: ucsbCcsLoginShells
20   objectclass: sambaSamAccount
21   cn: $NAME
# Line 32 | Line 23 | uid: $USER
23   uidNumber: $ID
24   gidNumber: $ID
25   homeDirectory: /home/$USER
26 < userPassword: `$SLAPPASSWD -T $FILE`
27 < ucsbCcsFreebsd: /usr/local/bin/bash
28 < ucsbCcsLinux: /bin/bash
38 < ucsbCcsDarwin: /bin/bash
39 < sambaPwdLastSet: `$DATE '+%s'`
26 > userPassword: `$slappasswd -T $FILE`
27 > $SHELLS
28 > sambaPwdLastSet: `$date '+%s'`
29   sambaAcctFlags: [U          ]
30   sambaSID: S-1-5-21-3739982181-3886045993-82308153-$ID
31   sambaPrimaryGroupSID: S-1-5-21-3739982181-3886045993-82308153-$((ID + 1000))
# Line 51 | Line 40 | sambaSID: S-1-5-21-3739982181-3886045993
40   sambaGroupType: 4
41   EOF
42  
43 < $LDAPMODIFY -D "uid=root,ou=People,$BASE" -x -y $SECRET <<<"`$LDAPSEARCH -b \
44 <        "ou=Group,$BASE" -LLL 'cn=wheel' | $SED -e "s/^$/memberUid: $USER/"`"
43 > $ldapmodify -D "uid=root,ou=People,$BASE" -x -y $SECRET <<<"`$ldapsearch -b \
44 >        "ou=Group,$BASE" -LLL 'cn=wheel' | $sed -e "s/^$/memberUid: $USER/"`"
45 > $ldapmodify -D "uid=root,ou=People,$BASE" -x -y $SECRET <<<"`ldapsearch -b \
46 >        "ou=Group,$BASE" -LLL 'cn=wheel' | $sed -e "s/^$/memberUid: $USER/"`"
47  
48 < $SMBPASSWD -s $USER
48 > $smbpasswd -s $USER

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines