Centos 7 vsftpd ldap configuration, centosvsftpd

Source: Internet
Author: User

Centos 7 vsftpd ldap configuration, centosvsftpd

# Centos7
# Installation
Yum install-y openldap-clients openldap-servers migrationtools pam_ldap python-ldap
# Disable the Firewall
Systemctl stop firewalld. service
# Configure domain name resolution
Echo "192.168.20.43 aodun.com">/etc/hosts
# Configure the ldap Service

Vim/etc/openldap/slapd. d/cn \ = config/olcDatabase \=\{ 2 \} hdb. ldif
OlcSuffix: dc = aodun (my-domain), dc = com
OlcRootDN: cn = admin, dc = aodun (my-domain), dc = com
Add a row:
OlcRootPW: 123456 # change the password as needed

Vim/etc/openldap/slapd. d/cn \ = config/olcDatabase \=\{ 1 \} monitor. ldif
# Modify the cn and dc items in dn. base = "" as above
OlcAccess: {0} to * by dn. base = "gidNumber = 0 + uidNumber = 0, cn = peercred, cn = extern
Al, cn = auth "read by dn. base =" cn = admin, dc = aodun (my-domain), dc = com "read by * none
# Prepare a database
Cp/usr/share/openldap-servers/DB_CONFIG.example/var/lib/ldap/DB_CONFIG
Chown-R ldap. ldap/var/lib/ldap
Slaptest-u

56e7c83d ldif_read_file: checksum error on "/etc/openldap/slapd. d/cn = config/olcDatabase = {1} monitor. ldif"
56e7c83d ldif_read_file: checksum error on "/etc/openldap/slapd. d/cn = config/olcDatabase = {2} hdb. ldif"
Config file testing succeeded # Verification Successful
# Start the service
Systemctl start slapd
#
Systemctl enable slapd
# Check ldap
Netstat-lt | grep ldap
Netstat-tunlp | egrep "389 | 636"
# Import basic configurations
Cd/etc/openldap/schema/
# Import all. ldif files in the directory to ldap
Ldapadd-y external-H ldapi: //-D "cn = config"-f cosine. ldif
# Generating basic files
Cd/usr/share/migrationtools/
Vim migrate_common.ph
Line 71: Change the Domain Name
$ DEFAULT_MAIL_DOMAIN = "aodun.com ";
74 rows, change the name
$ DEFAULT_BASE = "dc = aodun, dc = com ";
90 rows. Change the schema value.
$ EXTENDED_SCHEMA = 1;
./Migrate_base.pl>/root/base. ldif
# Loading basic files
Ldapadd-x-W-D "cn = admin, dc = aodun, dc = com"-f/root/base. ldif
# Configure vsftpd
Yum install vsftpd
Vim/etc/nslcd. conf
Uri ldap: // 192.168.20.43/
Base dc = aodun, dc = com
Ssl no
Service nslcd restart
Vim/etc/openldap/ldap. conf
Add
Host 192.168.255.43

# The distinguished name of the search base.
Base dc = aodun, dc = com
Uri ldap: // aodun.com
Binddn cn = admin, dc = aodun, dc = com
Bindpw 123456
Vim/etc/pam. d/vsftpd
Delete other additions
Auth required pam_ldap.so
Account required pam_ldap.so
Vim/etc/vsftpd. conf
# Remove the following option comments
Anon_upload_enable = YES (anonymous upload)
Anon_mkdir_write_enable = YES (create a directory anonymously)
Allow_writeable_chroot = YES
Xferlog_file =/var/log/xferlog (log, note:/var/log/xferlog needs to be manually created)
# Add the following content
Pam_service_name = vsftpd (User Authentication (vsftpd file in the/etc/pam. d/directory)
Userlist_enable = YES
Tcp_wrappers = YES
Use_localtime = YES
User_config_dir =/etc/vsftpd/userconf (virtual user permission configuration Directory, which must be created by yourself)
Guest_enable = YES (enable virtual user)
Guest_username = ftp (virtual user host user)
# Configure permissions for each user
Vim/etc/vsftpd/userconf/admin (the file must have the same name as the user)
Local_root =/ftp (user root directory)
Anon_world_readable_only = NO (upload and download)
Anon_other_write_enable = yes (delete/rename)
Write_enable = YES
Anon_upload_enable = YES
Anon_mkdir_write_enable = YES
Service vsftpd restart

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.