Article Title: Build Openldap Authentication Based on the NFS file system. Linux is a technology channel of the IT lab in China. Includes basic categories such as desktop applications, Linux system management, kernel research, embedded systems, and open source.
I. Description
LDAP (Lightweight Directory Access Protocol, Lightweight Directory Access Protocol) is an information service that provides a Directory service. Directory Service is a special database system, which is specially optimized for reading, browsing, and searching operations.
Ii. Download Software
Ftp://ftp.openldap.org/pub/OpenLDAP/openldap-stable/openldap-stable-20070831.tgz
Iii. Unzip and install
Operating Environment: RHEL AS4
# Gunzip openldap-stable-20070831.tgz
# Tar xvf openldap-stable-20070831.tar-C/tmp
# Cd/tmp
#./Configure -- prefix =/usr/local/openldap
# Make depend
# Make
# Make test
# Make install
Iv. Related configuration directories
LDAP background program slapd Directory:/usr/local/openldap/libexec
Configuration file directory:/usr/local/openldap/etc
Run the database Directory:/usr/local/openldap/var/openldap-data
OpenLDAP tool Directory:/usr/local/openldap/bin
5. modify the configuration file
1) change the configuration file/usr/local/etc/openldap/slapd. conf.
Add the following lines to the include/usr/local/etc/openldap/schema/core. schema line, including all solutions.
Include/usr/local/etc/openldap/schema/corba. schema
Include/usr/local/etc/openldap/schema/cosine. schema
Include/usr/local/etc/openldap/schema/inetorgperson. schema
Include/usr/local/etc/openldap/schema/java. schema
Include/usr/local/etc/openldap/schema/krb5-kdc.schema
Include/usr/local/etc/openldap/schema/misc. schema
Include/usr/local/etc/openldap/schema/nadf. schema
Include/usr/local/etc/openldap/schema/nis. schema
Include/usr/local/etc/openldap/schema/openldap. schema
2) In the "dbm database definitions" section of the slapd. conf file, change the corresponding
Suffix and rootdn lines are as follows:
Database dbm
Suffix "dc = example, dc = com"
Rootdn "cn = root, dc = example, dc = com"
Rootpw secret
Directory/usr/local/openldap/var/openldap-data
After the rootdn format is installed, the default value is cn = Manager. Here it is changed to root.
In Unix/Linux, root has the highest privilege.
3) Now you can start slapd and run/usr/local/openldap/libexec/slapd.
You can add/usr/local/bin and/usr/local/libexec to the search PATH, that is, add the PATH row to/etc/profile:
PATH = "$ PATH:/usr/X11R6/bin:/usr/local/openldap/libexec"
In this way, after the next login, you only need to type slapd
4) test whether the ldap server works properly.
Run the following command to check whether the output is correct.
# Ldapsearch-x-B "dc = example, dc = com" "(objectclass = *)"
5) download a migration script to create the. ldif file. Link:
Http://www.padl.com/download/MigrationTools.tgz
# Gunzip MigrationTools. tgz; tar xvf MigrationTools.tar-C/usr/local/openldap
# Cd/usr/local/openldap/MigrationTools-47
Edit the migrate_common.ph file and change the two lines to the following format:
$ DEFAULT_MAIL_DOMAIN = "example.com ";
$ DEFAULT_BASE = "dc = example, dc = com ";
The modification method must correspond to dc = example, dc = com in your/usr/local/openldap/etc/openldap/slapd. conf file.
Create a base. ldif text file
Run
#./Migrate_base.pl>/root/base. ldif
#./Migrate_group.pl/etc/group>/root/base. ldif
#./Migrate_passwd.pl/etc/passwd>/root/base. ldif
Use ldapadd to add records to the LDAP database.
The file content is as follows:
Dn: dc = example, dc = com
Dc: example
ObjectClass: top
ObjectClass: domain
Dn: ou = Hosts, dc = example, dc = com
Ou: Hosts
ObjectClass: top
ObjectClass: organizationalUnit
.................. More ............................................................
And so on. Add the records of each person to the file.
Then, run the following command to add the above. ldif file to the LDAP database.
# Ldapadd-x-D "cn = root, o = example, c = us"-w secret-f base. ldif
Note: The first part of the above file "dn: dc = example, dc = com" is required; otherwise, data cannot be added.
[1] [2] Next page