Build LDAP service under RedHat6

Source: Internet
Author: User
I have to take the RHCE test. There are several questions related to the LDAP service, and there is a ready-made LDAP server in the center. But the practice at home is tragic, So I struggled with LDAP for a few days, the test was completed based on the document configuration methods and ideas of the central teacher and the online documents. It is summarized as a document. If you are interested, you can use it as a reference. If you have any omissions, please reply and point out. Lab environment: RedHat6.3LDAPserver: 172.24.30.20LDAPclent: 172.24.30.25

I have to take the RHCE test. There are several questions related to the LDAP service, and there is a ready-made LDAP server in the center. But the practice at home is tragic, So I struggled with LDAP for a few days, the test was completed based on the document configuration methods and ideas of the central teacher and the online documents.

It is summarized as a document. If you are interested, you can use it as a reference. If you have any omissions, please reply and point out.

Lab environment:


RedHat6.3

LDAP server: 172.24.30.20

LDAP clent: 172.24.30.25

Preparations:

Disable iptables and SELINUX before configuration to avoid errors during configuration.

# Service iptables stop

# Setenforce 0

# Vi/etc/sysconfig/selinux

---------------

SELINUX = disabled

---------------

1. LDAP server Configuration:

Install the LDAP Service (use the YUM local disk for installation)

# Yum install openldap-*-y


Prompt to install the following four packages

Openldap-devel-2.4.23-26.el6.x86_64

Openldap-clients-2.4.23-26.el6.x86_64

Openldap-2.4.23-26.el6.x86_64

Openldap-servers-2.4.23-26.el6.x86_64

Copy the LDAP configuration file to the LDAP directory (redhat6.3 ):

# Cd/etc/openldap/

# Cp/usr/share/openldap-servers/slapd. conf. obsolete slapd. conf

The redhat6.0 or 6.1 configuration file is backed up in the main directory:

# Cd/etc/openldap/

# Cp slapd. conf. bak slapd. conf

Create an LDAP administrator password:

# Slappasswd

The password I entered here is redhat. After the password is entered, a string of ciphertext is returned and saved to the clipboard first.

{SSHA} pfAJm + JJa4ec2y8GjTc8uMEJpoR5YKLy

Compile the configuration file

# Vi/etc/openldap/slapd. conf

Find row 115, default

To:

Highlight the generated password (encrypted ).

The permissions of the last few lines of the configuration file must be changed accordingly:

Original content:

Changed:

Save and exit.

Copy the DB_CONFIG file to the specified directory.

# Cp/usr/share/openldap-servers/DB_CONFIG.example/var/lib/ldap/DB_CONFIG

Delete all content under/etc/openldap/slapd. d by default. Otherwise, an error will be reported when ldapadd is used:

# Rm-rf/etc/openldap/slapd. d /*


Start the LDAP Server Load balancer service and set the auto-start mode:

# Service slapd restart

# Chkconfig slapd on


Grant permissions to the configuration directory:

# Chown-R ldap: ldap/var/lib/ldap

# Chown-R ldap: ldap/etc/openldap/


Test and generate the configuration file:


Slaptest-f/etc/openldap/slapd. conf-F/etc/openldap/slapd. d

If config file testing succeeded is returned, the configuration is successful.


Grant permissions to the generated configuration file and restart it:

# Chown-R ldap: ldap/etc/openldap/slapd. d

# Service slapd restart

 

Create an account for test login on the client

# Useradd ldapuser1

# Passwd ldapuser1


So far, these users only exist on the system (stored on/etc/passwd and/etc/shadow) and are not in the LDAP database, therefore, we need to import these users into LDAP. However, LDAP can only identify files with the suffix ldif (also text files) in a specific format. Therefore, you cannot directly use/etc/passwd and/etc/shadow. The migrationtools tool is required to convert these two files into LDAP-aware files.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.