File: addou.pl

package info (click to toggle)
turba2 2.1.3-1etch1
  • links: PTS
  • area: main
  • in suites: etch
  • size: 5,736 kB
  • ctags: 1,500
  • sloc: php: 6,663; xml: 998; sql: 180; makefile: 63; sh: 46; perl: 17
file content (32 lines) | stat: -rwxr-xr-x 727 bytes parent folder | download | duplicates (12)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#!/usr/bin/perl -w
#
# LDAP add personal ou's from /home
# This script adds an ou for each directory in /home.
#
# Script by tarjei@nu.no.
# Remember to remove ou's like mailman, mysql, postgres, etc.

# Settings that should be changed for your setup:
$basedn = "ou=personal_addressbook, dc=example, dc=com";
$binddn = "uid=root, ou=People, dc=example, dc=com";
$passwd = "";
# End of configuration section - don't edit below here.

use Getopt::Std;
my %Options;
$user = $ARGV[0];
print "Adding ou: ou=$user,$basedn";

$FILE = "|/usr/bin/ldapadd -x $options -D '$binddn' -w $passwd";

open FILE or die;

print FILE <<EOF;
dn: ou=$user,$basedn
objectclass: top
objectClass: organizationalUnit
ou: $user

EOF
close FILE;
exit 0;