ViewVC Help
View File | Revision Log | Show Annotations | Download File | View Changeset | Root Listing
root/repos/CCSAdmin/adduser.sh
Revision: 583
Committed: 2005-11-21T12:56:05-08:00 (19 years, 7 months ago) by douglas
Content type: text/x-sh
File size: 1336 byte(s)
Log Message:
Refactorx0r!

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" -LLL -S 'uidNumber' 'uidNumber' \
11 | $sed -Ee 's/^uidNumber: (1[0-9]{3})$/\1/p;d' | $tail -n 1` + 1))
12
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
22 uid: $USER
23 uidNumber: $ID
24 gidNumber: $ID
25 homeDirectory: /home/$USER
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))
32
33 dn: cn=$USER,ou=Group,$BASE
34 objectclass: top
35 objectclass: posixGroup
36 objectclass: sambaGroupMapping
37 cn: $USER
38 gidNumber: $ID
39 sambaSID: S-1-5-21-3739982181-3886045993-82308153-$((ID + 1000))
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/"`"
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

Properties

Name Value
svn:executable *