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' |
12 |
|
|
13 |
< |
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)) |
13 |
> |
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 |
|
|
16 |
< |
$LDAPADD -D "uid=root,ou=People,$BASE" -x -y $SECRET <<EOF |
16 |
> |
$ldapadd -D "uid=root,ou=People,$BASE" -x -y $SECRET <<EOF |
17 |
|
dn: uid=$USER,ou=People,$BASE |
18 |
|
objectclass: top |
19 |
|
objectclass: account |
25 |
|
uidNumber: $ID |
26 |
|
gidNumber: $ID |
27 |
|
homeDirectory: /home/$USER |
28 |
< |
userPassword: `$SLAPPASSWD -T $FILE` |
28 |
> |
userPassword: `$slappasswd -T $FILE` |
29 |
|
ucsbCcsFreebsd: /usr/local/bin/bash |
30 |
|
ucsbCcsLinux: /bin/bash |
31 |
|
ucsbCcsDarwin: /bin/bash |
32 |
< |
sambaPwdLastSet: `$DATE '+%s'` |
32 |
> |
sambaPwdLastSet: `$date '+%s'` |
33 |
|
sambaAcctFlags: [U ] |
34 |
|
sambaSID: S-1-5-21-3739982181-3886045993-82308153-$ID |
35 |
|
sambaPrimaryGroupSID: S-1-5-21-3739982181-3886045993-82308153-$((ID + 1000)) |
44 |
|
sambaGroupType: 4 |
45 |
|
EOF |
46 |
|
|
47 |
< |
$LDAPMODIFY -D "uid=root,ou=People,$BASE" -x -y $SECRET <<<"`$LDAPSEARCH -b \ |
48 |
< |
"ou=Group,$BASE" -LLL 'cn=wheel' | $SED -e "s/^$/memberUid: $USER/"`" |
47 |
> |
$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 |
|
|
50 |
< |
$SMBPASSWD -s $USER |
50 |
> |
$smbpasswd -s $USER |