ViewVC Help
View File | Revision Log | Show Annotations | Download File | View Changeset | Root Listing
root/repos/CCSAdmin/adduser.sh
Revision: 566
Committed: 2005-08-28T22:29:20-07:00 (19 years, 10 months ago) by douglas
Content type: text/x-sh
File size: 1295 byte(s)
Log Message:
Worky!

File Contents

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

Properties

Name Value
svn:executable *