Statement
The Stars last night
Blog:http://yestreenstars.blog.51cto.com/
This article by oneself creation, if need reprint, please indicate source, thank cooperation!
Objective
through MySQL implements virtual user access to the FTP server.
Configuration
# Install all the packages used in this experiment Yum -y install vsftpd mysql-server mysql-devel pam-devel gcc-c++ make wget# Start mysqld Service service mysqld start# Initialize database administrator password mysqladmin -uroot password redhat# Login Database mysql -uroot -predhat# Create Vftpuser database database vftpuser;# Enter Vftpuser database use vftpuser;# CREATE table to store account and password create table Users (Name char), Pwd char ();# Create test User insert into users (name,pwd) values (' Test ', password (' Test '));# to create a user dedicated to querying the users table for security purposes Grant select on vftpuser.users to [email protected] identified by ' Redhat ';# refresh permission table flush privileges;# Leave the database quit;# download the MySQL-certified PAM module and install the wget http://ncu.dl.sourceforge.net/project/pam-mysql/pam-mysql/ 0.7rc1/pam_mysql-0.7rc1.tar.gztar xzf pam_mysql-0.7rc1.tar.gzcd pam_mysql-0.7rc1./configuremake && make install# Modify the/etc/pam.d/vsftpd file, comment The original content, add the following content auth required /lib/security/pam_mysql.so user=vsqluser passwd=redhat host= Localhost db=vftpuser table=users usercolumn=name passwdcolumn=pwd crypt=2account required /lib/security/pam_mysql.so user=vsqluser passwd=redhat host=localhost db=vftpuser table=users usercolumn=name passwdcolumn=pwd crypt=2# creating a local user to map a virtual user useradd -d /var/ftp/vuserdir -s /sbin/ nologin vuser# replaces the original contents of the/etc/vsftpd/vsftpd.conf file with the following contents listen=yespam_service_name=vsftpdguest_enable= yesguest_username=vuseranonymous_enable=noanon_world_readable_only=nolocal_enable=yes# starting the VSFTPD Services service vsftpd start
This article is from "Last Night Stars" blog, please be sure to keep this source http://yestreenstars.blog.51cto.com/1836303/1429373