ViewVC Help
View File | Revision Log | Show Annotations | Download File | View Changeset | Root Listing
root/repos/CCSAdmin/adduser.sh
Revision: 582
Committed: 2005-11-20T15:07:31-08:00 (19 years, 7 months ago) by douglas
Content type: text/x-sh
File size: 1443 byte(s)
Log Message:
Solaris!

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 566 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 douglas 562
13 douglas 566 $ldapadd -D "uid=root,ou=People,$BASE" -x -y $SECRET <<EOF
14 douglas 562 dn: uid=$USER,ou=People,$BASE
15     objectclass: top
16     objectclass: account
17     objectclass: posixAccount
18 douglas 572 objectclass: shadowAccount
19 douglas 562 objectclass: ucsbCcsLoginShells
20     objectclass: sambaSamAccount
21     cn: $NAME
22     uid: $USER
23     uidNumber: $ID
24     gidNumber: $ID
25     homeDirectory: /home/$USER
26 douglas 566 userPassword: `$slappasswd -T $FILE`
27 douglas 562 ucsbCcsFreebsd: /usr/local/bin/bash
28     ucsbCcsLinux: /bin/bash
29     ucsbCcsDarwin: /bin/bash
30 douglas 582 ucsbCcsSolaris: /usr/bin/bash
31 douglas 566 sambaPwdLastSet: `$date '+%s'`
32 douglas 562 sambaAcctFlags: [U ]
33     sambaSID: S-1-5-21-3739982181-3886045993-82308153-$ID
34     sambaPrimaryGroupSID: S-1-5-21-3739982181-3886045993-82308153-$((ID + 1000))
35    
36     dn: cn=$USER,ou=Group,$BASE
37     objectclass: top
38     objectclass: posixGroup
39     objectclass: sambaGroupMapping
40     cn: $USER
41     gidNumber: $ID
42     sambaSID: S-1-5-21-3739982181-3886045993-82308153-$((ID + 1000))
43     sambaGroupType: 4
44     EOF
45    
46 douglas 566 $ldapmodify -D "uid=root,ou=People,$BASE" -x -y $SECRET <<<"`$ldapsearch -b \
47     "ou=Group,$BASE" -LLL 'cn=wheel' | $sed -e "s/^$/memberUid: $USER/"`"
48 douglas 573 $ldapmodify -D "uid=root,ou=People,$BASE" -x -y $SECRET <<<"`ldapsearch -b \
49     "ou=Group,$BASE" -LLL 'cn=wheel' | $sed -e "s/^$/memberUid: $USER/"`"
50 douglas 562
51 douglas 566 $smbpasswd -s $USER

Properties

Name Value
svn:executable *